Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / lib / Drupal / Core / Plugin / PluginFormInterface.php
1 <?php
2
3 namespace Drupal\Core\Plugin;
4
5 use Drupal\Core\Form\FormStateInterface;
6
7 /**
8  * Provides an interface for an embeddable plugin form.
9  *
10  * Plugins can implement this form directly, or a standalone class can be used.
11  * Decoupled forms can implement \Drupal\Component\Plugin\PluginAwareInterface
12  * in order to gain access to the plugin.
13  *
14  * @ingroup plugin_api
15  */
16 interface PluginFormInterface {
17
18   /**
19    * Form constructor.
20    *
21    * Plugin forms are embedded in other forms. In order to know where the plugin
22    * form is located in the parent form, #parents and #array_parents must be
23    * known, but these are not available during the initial build phase. In order
24    * to have these properties available when building the plugin form's
25    * elements, let this method return a form element that has a #process
26    * callback and build the rest of the form in the callback. By the time the
27    * callback is executed, the element's #parents and #array_parents properties
28    * will have been set by the form API. For more documentation on #parents and
29    * #array_parents, see \Drupal\Core\Render\Element\FormElement.
30    *
31    * @param array $form
32    *   An associative array containing the initial structure of the plugin form.
33    * @param \Drupal\Core\Form\FormStateInterface $form_state
34    *   The current state of the form. Calling code should pass on a subform
35    *   state created through
36    *   \Drupal\Core\Form\SubformState::createForSubform().
37    *
38    * @return array
39    *   The form structure.
40    */
41   public function buildConfigurationForm(array $form, FormStateInterface $form_state);
42
43   /**
44    * Form validation handler.
45    *
46    * @param array $form
47    *   An associative array containing the structure of the plugin form as built
48    *   by static::buildConfigurationForm().
49    * @param \Drupal\Core\Form\FormStateInterface $form_state
50    *   The current state of the form. Calling code should pass on a subform
51    *   state created through
52    *   \Drupal\Core\Form\SubformState::createForSubform().
53    */
54   public function validateConfigurationForm(array &$form, FormStateInterface $form_state);
55
56   /**
57    * Form submission handler.
58    *
59    * @param array $form
60    *   An associative array containing the structure of the plugin form as built
61    *   by static::buildConfigurationForm().
62    * @param \Drupal\Core\Form\FormStateInterface $form_state
63    *   The current state of the form. Calling code should pass on a subform
64    *   state created through
65    *   \Drupal\Core\Form\SubformState::createForSubform().
66    */
67   public function submitConfigurationForm(array &$form, FormStateInterface $form_state);
68
69 }