protected function QuickNodeCloneNodeForm::actions in Quick Node Clone 8
Returns an array of supported actions for the current entity form.
This function generates a list of Form API elements which represent actions supported by the current entity form.
@todo Consider introducing a 'preview' action here, since it is used by many entity types.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array An array of supported Form API action elements keyed by name.
Overrides NodeForm::actions
File
- src/
Form/ QuickNodeCloneNodeForm.php, line 18
Class
- QuickNodeCloneNodeForm
- Form controller for Quick Node Clone edit forms.
Namespace
Drupal\quick_node_clone\FormCode
protected function actions(array $form, FormStateInterface $form_state) {
$element = parent::actions($form, $form_state);
// Brand the Publish / Unpublish buttons, but first check if they are still
// there.
$clone_string = $this
->t('New Clone:');
if (!empty($element['publish']['#value'])) {
$element['publish']['#value'] = $clone_string . ' ' . $element['publish']['#value'];
}
if (!empty($element['unpublish']['#value'])) {
$element['unpublish']['#value'] = $clone_string . ' ' . $element['unpublish']['#value'];
}
return $element;
}