FormStateDecoratorBase.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. <?php
  2. namespace Drupal\Core\Form;
  3. use Drupal\Core\Url;
  4. use Symfony\Component\HttpFoundation\Response;
  5. /**
  6. * Decorates another form state.
  7. */
  8. abstract class FormStateDecoratorBase implements FormStateInterface {
  9. /**
  10. * The decorated form state.
  11. *
  12. * @var \Drupal\Core\Form\FormStateInterface
  13. */
  14. protected $decoratedFormState;
  15. /**
  16. * {@inheritdoc}
  17. */
  18. public function setFormState(array $form_state_additions) {
  19. $this->decoratedFormState->setFormState($form_state_additions);
  20. return $this;
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function setAlwaysProcess($always_process = TRUE) {
  26. $this->decoratedFormState->setAlwaysProcess($always_process);
  27. return $this;
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function getAlwaysProcess() {
  33. return $this->decoratedFormState->getAlwaysProcess();
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function setButtons(array $buttons) {
  39. $this->decoratedFormState->setButtons($buttons);
  40. return $this;
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function getButtons() {
  46. return $this->decoratedFormState->getButtons();
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function setCached($cache = TRUE) {
  52. $this->decoratedFormState->setCached($cache);
  53. return $this;
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function isCached() {
  59. return $this->decoratedFormState->isCached();
  60. }
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function disableCache() {
  65. $this->decoratedFormState->disableCache();
  66. return $this;
  67. }
  68. /**
  69. * {@inheritdoc}
  70. */
  71. public function setExecuted() {
  72. $this->decoratedFormState->setExecuted();
  73. return $this;
  74. }
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function isExecuted() {
  79. return $this->decoratedFormState->isExecuted();
  80. }
  81. /**
  82. * {@inheritdoc}
  83. */
  84. public function setGroups(array $groups) {
  85. $this->decoratedFormState->setGroups($groups);
  86. return $this;
  87. }
  88. /**
  89. * {@inheritdoc}
  90. */
  91. public function &getGroups() {
  92. return $this->decoratedFormState->getGroups();
  93. }
  94. /**
  95. * {@inheritdoc}
  96. */
  97. public function setHasFileElement($has_file_element = TRUE) {
  98. $this->decoratedFormState->setHasFileElement($has_file_element);
  99. return $this;
  100. }
  101. /**
  102. * {@inheritdoc}
  103. */
  104. public function hasFileElement() {
  105. return $this->decoratedFormState->hasFileElement();
  106. }
  107. /**
  108. * {@inheritdoc}
  109. */
  110. public function setLimitValidationErrors($limit_validation_errors) {
  111. $this->decoratedFormState->setLimitValidationErrors($limit_validation_errors);
  112. return $this;
  113. }
  114. /**
  115. * {@inheritdoc}
  116. */
  117. public function getLimitValidationErrors() {
  118. return $this->decoratedFormState->getLimitValidationErrors();
  119. }
  120. /**
  121. * {@inheritdoc}
  122. */
  123. public function setMethod($method) {
  124. $this->decoratedFormState->setMethod($method);
  125. return $this;
  126. }
  127. /**
  128. * {@inheritdoc}
  129. */
  130. public function isMethodType($method_type) {
  131. return $this->decoratedFormState->isMethodType($method_type);
  132. }
  133. /**
  134. * {@inheritdoc}
  135. */
  136. public function setRequestMethod($method) {
  137. $this->decoratedFormState->setRequestMethod($method);
  138. return $this;
  139. }
  140. /**
  141. * {@inheritdoc}
  142. */
  143. public function setValidationEnforced($must_validate = TRUE) {
  144. $this->decoratedFormState->setValidationEnforced($must_validate);
  145. return $this;
  146. }
  147. /**
  148. * {@inheritdoc}
  149. */
  150. public function isValidationEnforced() {
  151. return $this->decoratedFormState->isValidationEnforced();
  152. }
  153. /**
  154. * {@inheritdoc}
  155. */
  156. public function disableRedirect($no_redirect = TRUE) {
  157. $this->decoratedFormState->disableRedirect($no_redirect);
  158. return $this;
  159. }
  160. /**
  161. * {@inheritdoc}
  162. */
  163. public function isRedirectDisabled() {
  164. return $this->decoratedFormState->isRedirectDisabled();
  165. }
  166. /**
  167. * {@inheritdoc}
  168. */
  169. public function setProcessInput($process_input = TRUE) {
  170. $this->decoratedFormState->setProcessInput($process_input);
  171. return $this;
  172. }
  173. /**
  174. * {@inheritdoc}
  175. */
  176. public function isProcessingInput() {
  177. return $this->decoratedFormState->isProcessingInput();
  178. }
  179. /**
  180. * {@inheritdoc}
  181. */
  182. public function setProgrammed($programmed = TRUE) {
  183. $this->decoratedFormState->setProgrammed($programmed);
  184. return $this;
  185. }
  186. /**
  187. * {@inheritdoc}
  188. */
  189. public function isProgrammed() {
  190. return $this->decoratedFormState->isProgrammed();
  191. }
  192. /**
  193. * {@inheritdoc}
  194. */
  195. public function setProgrammedBypassAccessCheck($programmed_bypass_access_check = TRUE) {
  196. $this->decoratedFormState->setProgrammedBypassAccessCheck($programmed_bypass_access_check);
  197. return $this;
  198. }
  199. /**
  200. * {@inheritdoc}
  201. */
  202. public function isBypassingProgrammedAccessChecks() {
  203. return $this->decoratedFormState->isBypassingProgrammedAccessChecks();
  204. }
  205. /**
  206. * {@inheritdoc}
  207. */
  208. public function setRebuildInfo(array $rebuild_info) {
  209. $this->decoratedFormState->setRebuildInfo($rebuild_info);
  210. return $this;
  211. }
  212. /**
  213. * {@inheritdoc}
  214. */
  215. public function getRebuildInfo() {
  216. return $this->decoratedFormState->getRebuildInfo();
  217. }
  218. /**
  219. * {@inheritdoc}
  220. */
  221. public function addRebuildInfo($property, $value) {
  222. $this->decoratedFormState->addRebuildInfo($property, $value);
  223. return $this;
  224. }
  225. /**
  226. * {@inheritdoc}
  227. */
  228. public function setStorage(array $storage) {
  229. $this->decoratedFormState->setStorage($storage);
  230. return $this;
  231. }
  232. /**
  233. * {@inheritdoc}
  234. */
  235. public function &getStorage() {
  236. return $this->decoratedFormState->getStorage();
  237. }
  238. /**
  239. * {@inheritdoc}
  240. */
  241. public function setSubmitHandlers(array $submit_handlers) {
  242. $this->decoratedFormState->setSubmitHandlers($submit_handlers);
  243. return $this;
  244. }
  245. /**
  246. * {@inheritdoc}
  247. */
  248. public function getSubmitHandlers() {
  249. return $this->decoratedFormState->getSubmitHandlers();
  250. }
  251. /**
  252. * {@inheritdoc}
  253. */
  254. public function setSubmitted() {
  255. $this->decoratedFormState->setSubmitted();
  256. return $this;
  257. }
  258. /**
  259. * {@inheritdoc}
  260. */
  261. public function isSubmitted() {
  262. return $this->decoratedFormState->isSubmitted();
  263. }
  264. /**
  265. * {@inheritdoc}
  266. */
  267. public function setTemporary(array $temporary) {
  268. $this->decoratedFormState->setTemporary($temporary);
  269. return $this;
  270. }
  271. /**
  272. * {@inheritdoc}
  273. */
  274. public function getTemporary() {
  275. return $this->decoratedFormState->getTemporary();
  276. }
  277. /**
  278. * {@inheritdoc}
  279. */
  280. public function &getTemporaryValue($key) {
  281. return $this->decoratedFormState->getTemporaryValue($key);
  282. }
  283. /**
  284. * {@inheritdoc}
  285. */
  286. public function setTemporaryValue($key, $value) {
  287. $this->decoratedFormState->setTemporaryValue($key, $value);
  288. return $this;
  289. }
  290. /**
  291. * {@inheritdoc}
  292. */
  293. public function hasTemporaryValue($key) {
  294. return $this->decoratedFormState->hasTemporaryValue($key);
  295. }
  296. /**
  297. * {@inheritdoc}
  298. */
  299. public function setTriggeringElement($triggering_element) {
  300. $this->decoratedFormState->setTriggeringElement($triggering_element);
  301. return $this;
  302. }
  303. /**
  304. * {@inheritdoc}
  305. */
  306. public function &getTriggeringElement() {
  307. return $this->decoratedFormState->getTriggeringElement();
  308. }
  309. /**
  310. * {@inheritdoc}
  311. */
  312. public function setValidateHandlers(array $validate_handlers) {
  313. $this->decoratedFormState->setValidateHandlers($validate_handlers);
  314. return $this;
  315. }
  316. /**
  317. * {@inheritdoc}
  318. */
  319. public function getValidateHandlers() {
  320. return $this->decoratedFormState->getValidateHandlers();
  321. }
  322. /**
  323. * {@inheritdoc}
  324. */
  325. public function setValidationComplete($validation_complete = TRUE) {
  326. $this->decoratedFormState->setValidationComplete($validation_complete);
  327. return $this;
  328. }
  329. /**
  330. * {@inheritdoc}
  331. */
  332. public function isValidationComplete() {
  333. return $this->decoratedFormState->isValidationComplete();
  334. }
  335. /**
  336. * {@inheritdoc}
  337. */
  338. public function loadInclude($module, $type, $name = NULL) {
  339. return $this->decoratedFormState->loadInclude($module, $type, $name);
  340. }
  341. /**
  342. * {@inheritdoc}
  343. */
  344. public function getCacheableArray() {
  345. return $this->decoratedFormState->getCacheableArray();
  346. }
  347. /**
  348. * {@inheritdoc}
  349. */
  350. public function setCompleteForm(array &$complete_form) {
  351. $this->decoratedFormState->setCompleteForm($complete_form);
  352. return $this;
  353. }
  354. /**
  355. * {@inheritdoc}
  356. */
  357. public function &getCompleteForm() {
  358. return $this->decoratedFormState->getCompleteForm();
  359. }
  360. /**
  361. * {@inheritdoc}
  362. */
  363. public function &get($property) {
  364. return $this->decoratedFormState->get($property);
  365. }
  366. /**
  367. * {@inheritdoc}
  368. */
  369. public function set($property, $value) {
  370. $this->decoratedFormState->set($property, $value);
  371. return $this;
  372. }
  373. /**
  374. * {@inheritdoc}
  375. */
  376. public function has($property) {
  377. return $this->decoratedFormState->has($property);
  378. }
  379. /**
  380. * {@inheritdoc}
  381. */
  382. public function setBuildInfo(array $build_info) {
  383. $this->decoratedFormState->setBuildInfo($build_info);
  384. return $this;
  385. }
  386. /**
  387. * {@inheritdoc}
  388. */
  389. public function getBuildInfo() {
  390. return $this->decoratedFormState->getBuildInfo();
  391. }
  392. /**
  393. * {@inheritdoc}
  394. */
  395. public function addBuildInfo($property, $value) {
  396. $this->decoratedFormState->addBuildInfo($property, $value);
  397. return $this;
  398. }
  399. /**
  400. * {@inheritdoc}
  401. */
  402. public function &getUserInput() {
  403. return $this->decoratedFormState->getUserInput();
  404. }
  405. /**
  406. * {@inheritdoc}
  407. */
  408. public function setUserInput(array $user_input) {
  409. $this->decoratedFormState->setUserInput($user_input);
  410. return $this;
  411. }
  412. /**
  413. * {@inheritdoc}
  414. */
  415. public function &getValues() {
  416. return $this->decoratedFormState->getValues();
  417. }
  418. /**
  419. * {@inheritdoc}
  420. */
  421. public function &getValue($key, $default = NULL) {
  422. return $this->decoratedFormState->getValue($key, $default);
  423. }
  424. /**
  425. * {@inheritdoc}
  426. */
  427. public function setValues(array $values) {
  428. $this->decoratedFormState->setValues($values);
  429. return $this;
  430. }
  431. /**
  432. * {@inheritdoc}
  433. */
  434. public function setValue($key, $value) {
  435. $this->decoratedFormState->setValue($key, $value);
  436. return $this;
  437. }
  438. /**
  439. * {@inheritdoc}
  440. */
  441. public function unsetValue($key) {
  442. $this->decoratedFormState->unsetValue($key);
  443. return $this;
  444. }
  445. /**
  446. * {@inheritdoc}
  447. */
  448. public function hasValue($key) {
  449. return $this->decoratedFormState->hasValue($key);
  450. }
  451. /**
  452. * {@inheritdoc}
  453. */
  454. public function isValueEmpty($key) {
  455. return $this->decoratedFormState->isValueEmpty($key);
  456. }
  457. /**
  458. * {@inheritdoc}
  459. */
  460. public function setValueForElement(array $element, $value) {
  461. $this->decoratedFormState->setValueForElement($element, $value);
  462. return $this;
  463. }
  464. /**
  465. * {@inheritdoc}
  466. */
  467. public function setResponse(Response $response) {
  468. $this->decoratedFormState->setResponse($response);
  469. return $this;
  470. }
  471. /**
  472. * {@inheritdoc}
  473. */
  474. public function getResponse() {
  475. return $this->decoratedFormState->getResponse();
  476. }
  477. /**
  478. * {@inheritdoc}
  479. */
  480. public function setRedirect($route_name, array $route_parameters = [], array $options = []) {
  481. $this->decoratedFormState->setRedirect($route_name, $route_parameters, $options);
  482. return $this;
  483. }
  484. /**
  485. * {@inheritdoc}
  486. */
  487. public function setRedirectUrl(Url $url) {
  488. $this->decoratedFormState->setRedirectUrl($url);
  489. return $this;
  490. }
  491. /**
  492. * {@inheritdoc}
  493. */
  494. public function getRedirect() {
  495. return $this->decoratedFormState->getRedirect();
  496. }
  497. /**
  498. * {@inheritdoc}
  499. */
  500. public static function hasAnyErrors() {
  501. return FormState::hasAnyErrors();
  502. }
  503. /**
  504. * {@inheritdoc}
  505. */
  506. public function setErrorByName($name, $message = '') {
  507. $this->decoratedFormState->setErrorByName($name, $message);
  508. return $this;
  509. }
  510. /**
  511. * {@inheritdoc}
  512. */
  513. public function setError(array &$element, $message = '') {
  514. $this->decoratedFormState->setError($element, $message);
  515. return $this;
  516. }
  517. /**
  518. * {@inheritdoc}
  519. */
  520. public function clearErrors() {
  521. $this->decoratedFormState->clearErrors();
  522. }
  523. /**
  524. * {@inheritdoc}
  525. */
  526. public function getError(array $element) {
  527. return $this->decoratedFormState->getError($element);
  528. }
  529. /**
  530. * {@inheritdoc}
  531. */
  532. public function getErrors() {
  533. return $this->decoratedFormState->getErrors();
  534. }
  535. /**
  536. * {@inheritdoc}
  537. */
  538. public function setRebuild($rebuild = TRUE) {
  539. $this->decoratedFormState->setRebuild($rebuild);
  540. return $this;
  541. }
  542. /**
  543. * {@inheritdoc}
  544. */
  545. public function isRebuilding() {
  546. return $this->decoratedFormState->isRebuilding();
  547. }
  548. /**
  549. * {@inheritdoc}
  550. */
  551. public function setInvalidToken($invalid_token) {
  552. $this->decoratedFormState->setInvalidToken($invalid_token);
  553. return $this;
  554. }
  555. /**
  556. * {@inheritdoc}
  557. */
  558. public function hasInvalidToken() {
  559. return $this->decoratedFormState->hasInvalidToken();
  560. }
  561. /**
  562. * {@inheritdoc}
  563. */
  564. public function prepareCallback($callback) {
  565. return $this->decoratedFormState->prepareCallback($callback);
  566. }
  567. /**
  568. * {@inheritdoc}
  569. */
  570. public function setFormObject(FormInterface $form_object) {
  571. $this->decoratedFormState->setFormObject($form_object);
  572. return $this;
  573. }
  574. /**
  575. * {@inheritdoc}
  576. */
  577. public function getFormObject() {
  578. return $this->decoratedFormState->getFormObject();
  579. }
  580. /**
  581. * {@inheritdoc}
  582. */
  583. public function getCleanValueKeys() {
  584. return $this->decoratedFormState->getCleanValueKeys();
  585. }
  586. /**
  587. * {@inheritdoc}
  588. */
  589. public function setCleanValueKeys(array $cleanValueKeys) {
  590. $this->decoratedFormState->setCleanValueKeys($cleanValueKeys);
  591. return $this;
  592. }
  593. /**
  594. * {@inheritdoc}
  595. */
  596. public function addCleanValueKey($cleanValueKey) {
  597. $this->decoratedFormState->addCleanValueKey($cleanValueKey);
  598. return $this;
  599. }
  600. /**
  601. * {@inheritdoc}
  602. */
  603. public function cleanValues() {
  604. $this->decoratedFormState->cleanValues();
  605. return $this;
  606. }
  607. }