Mercurial > hg > isophonics-drupal-site
annotate core/modules/action/src/ActionAddForm.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\action; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\Form\FormStateInterface; |
Chris@0 | 6 |
Chris@0 | 7 /** |
Chris@0 | 8 * Provides a form for action add forms. |
Chris@14 | 9 * |
Chris@14 | 10 * @internal |
Chris@0 | 11 */ |
Chris@0 | 12 class ActionAddForm extends ActionFormBase { |
Chris@0 | 13 |
Chris@0 | 14 /** |
Chris@0 | 15 * {@inheritdoc} |
Chris@0 | 16 * |
Chris@0 | 17 * @param string $action_id |
Chris@14 | 18 * The action ID. |
Chris@0 | 19 */ |
Chris@0 | 20 public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) { |
Chris@14 | 21 $this->entity->setPlugin($action_id); |
Chris@14 | 22 |
Chris@14 | 23 // Derive the label and type from the action definition. |
Chris@14 | 24 $definition = $this->entity->getPluginDefinition(); |
Chris@14 | 25 $this->entity->set('label', $definition['label']); |
Chris@14 | 26 $this->entity->set('type', $definition['type']); |
Chris@0 | 27 |
Chris@0 | 28 return parent::buildForm($form, $form_state); |
Chris@0 | 29 } |
Chris@0 | 30 |
Chris@0 | 31 } |