59d56ecd90a032cb9145308460e3c1c0aa81af31
[yaffs-website] / web / core / modules / action / src / ActionAddForm.php
1 <?php
2
3 namespace Drupal\action;
4
5 use Drupal\Core\Form\FormStateInterface;
6
7 /**
8  * Provides a form for action add forms.
9  *
10  * @internal
11  */
12 class ActionAddForm extends ActionFormBase {
13
14   /**
15    * {@inheritdoc}
16    *
17    * @param string $action_id
18    *   The action ID.
19    */
20   public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) {
21     $this->entity->setPlugin($action_id);
22
23     // Derive the label and type from the action definition.
24     $definition = $this->entity->getPluginDefinition();
25     $this->entity->set('label', $definition['label']);
26     $this->entity->set('type', $definition['type']);
27
28     return parent::buildForm($form, $form_state);
29   }
30
31 }