You are here

public function Node::getBundleFormSubmitHandlerAttachLocations in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php \Drupal\rh_node\Plugin\RabbitHoleEntityPlugin\Node::getBundleFormSubmitHandlerAttachLocations()

Return locations to attach submit handlers to entity bundle form.

This should return an array of arrays, e.g.: [ ['actions', 'submit', '#publish'], ['actions', 'publish', '#submit'], ].

Return value

array A multidimensional array.

Overrides RabbitHoleEntityPluginBase::getBundleFormSubmitHandlerAttachLocations

File

modules/rh_node/src/Plugin/RabbitHoleEntityPlugin/Node.php, line 22

Class

Node
Implements rabbit hole behavior for nodes.

Namespace

Drupal\rh_node\Plugin\RabbitHoleEntityPlugin

Code

public function getBundleFormSubmitHandlerAttachLocations(array $form, FormStateInterface $form_state) {
  if (\Drupal::moduleHandler()
    ->moduleExists('field_ui') && $form_state
    ->getFormObject()
    ->getEntity()
    ->isNew()) {
    return [
      [
        'actions',
        'save_continue',
        '#submit',
      ],
    ];
  }
  return parent::getBundleFormSubmitHandlerAttachLocations($form, $form_state);
}