Form constructor.
array $form: An associative array containing the structure of the form.
array $form_state: An associative array containing the current state of the form.
array The form structure.
Overrides FormInterface::buildForm
public function buildForm(array $form, array &$form_state) {
$actions = array();
foreach ($this->manager
->getDefinitions() as $id => $definition) {
if (is_subclass_of($definition['class'], '\\Drupal\\Core\\Action\\ConfigurableActionInterface')) {
$key = Crypt::hashBase64($id);
$actions[$key] = $definition['label'] . '...';
}
}
$form['parent'] = array(
'#type' => 'details',
'#title' => t('Create an advanced action'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['parent']['action'] = array(
'#type' => 'select',
'#title' => t('Action'),
'#title_display' => 'invisible',
'#options' => $actions,
'#empty_option' => t('Choose an advanced action'),
);
$form['parent']['actions'] = array(
'#type' => 'actions',
);
$form['parent']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Create'),
);
return $form;
}