You are here

protected function ModuleBuilderComponentFormBase::actions in Module Builder 7.2

Returns an array of supported actions for the current entity form.

File

includes/module_builder.form.inc, line 618

Class

ModuleBuilderComponentFormBase
Backport of ComponentFormBase from 8.x-3.x version.

Code

protected function actions(array $form, FormStateInterface $form_state) {

  // TODO: remove #mb_action, use #name instead.
  $actions['submit'] = array(
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
    '#dropbutton' => 'mb',
    // Still no way to get a button's name, apparently?
    '#mb_action' => 'submit',
    '#submit' => array(
      '::submitForm',
      '::save',
    ),
  );
  if ($this
    ->getNextLink() != 'generate-form') {
    $actions['submit_next'] = array(
      '#type' => 'submit',
      '#value' => $this
        ->t('Save and go to next page'),
      '#dropbutton' => 'mb',
      '#mb_action' => 'submit_next',
      '#submit' => array(
        '::submitForm',
        '::save',
      ),
    );
  }
  $actions['submit_generate'] = array(
    '#type' => 'submit',
    '#value' => $this
      ->t('Save and generate code'),
    '#dropbutton' => 'mb',
    '#mb_action' => 'submit_generate',
    '#submit' => array(
      '::submitForm',
      '::save',
    ),
  );
  return $actions;
}