You are here

protected function ConfigPagesForm::actions in Config Pages 8

Same name and namespace in other branches
  1. 8.3 src/ConfigPagesForm.php \Drupal\config_pages\ConfigPagesForm::actions()
  2. 8.2 src/ConfigPagesForm.php \Drupal\config_pages\ConfigPagesForm::actions()

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

@todo Consider introducing a 'preview' action here, since it is used by many entity types.

Overrides EntityForm::actions

File

src/ConfigPagesForm.php, line 273

Class

ConfigPagesForm
Form controller for the custom config page edit forms.

Namespace

Drupal\config_pages

Code

protected function actions(array $form, FormStateInterface $form_state) {
  $entity = $this->entity;

  // Save ConfigPage entity.
  $actions['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
    '#submit' => array(
      '::submitForm',
      '::save',
    ),
  ];
  if (!$entity
    ->isNew()) {

    // Add button to reset values.
    $actions['reset'] = [
      '#type' => 'submit',
      '#value' => t('Clear values'),
      '#submit' => array(
        '::configPagesClearValues',
      ),
      '#button_type' => "submit",
    ];
  }
  return $actions;
}