actions example


  public function exists($id) {
    $action = $this->storage->load($id);
    return !empty($action);
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    unset($actions['delete']);
    return $actions;
  }

  /** * {@inheritdoc} */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form$form_state);
    if ($plugin = $this->getPlugin()) {
      $plugin->validateConfigurationForm($form$form_state);
    }
'tab_content' => $tab_content,
      ];
    }

    return $form;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    unset($actions['delete']);

    $actions['cancel'] = [
      '#type' => 'submit',
      '#value' => $this->t('Cancel'),
      '#submit' => ['::cancel'],
      '#limit_validation_errors' => [],
    ];
    if ($this->entity->isLocked()) {
      $actions['submit']['#access'] = FALSE;
      $actions['cancel']['#access'] = FALSE;
    }
// Content entity forms do not use the parent's #after_build callback.     unset($form['#after_build']);

    return $form;
  }

  /** * {@inheritdoc} */
  public function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['cancel']['#attributes']['class'][] = 'dialog-cancel';
    return $actions;
  }

  /** * {@inheritdoc} */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    try {
      $this->workspaceManager->setActiveWorkspace($this->entity);
      $this->messenger->addMessage($this->t('%workspace_label is now the active workspace.', ['%workspace_label' => $this->entity->label()]));
    }
/** * Provides a form for editing a search page. * * @internal */
class SearchPageEditForm extends SearchPageFormBase {

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['submit']['#value'] = $this->t('Save search page');
    return $actions;
  }

  /** * {@inheritdoc} */
  public function save(array $form, FormStateInterface $form_state) {
    parent::save($form$form_state);

    $this->messenger()->addStatus($this->t('The %label search page has been updated.', ['%label' => $this->entity->label()]));
  }

  public function getEntityFromRouteMatch(RouteMatchInterface $route_match$entity_type_id) {
    $route_parameters = $route_match->getParameters()->all();

    return $this->entityTypeManager->getStorage('entity_view_display')->load($route_parameters['entity_type_id'] . '.' . $route_parameters['bundle'] . '.' . $route_parameters['view_mode_name']);
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['#attributes']['role'] = 'region';
    $actions['#attributes']['aria-label'] = $this->t('Layout Builder tools');
    $actions['submit']['#value'] = $this->t('Save layout');
    $actions['#weight'] = -1000;

    $actions['discard_changes'] = [
      '#type' => 'submit',
      '#value' => $this->t('Discard changes'),
      '#submit' => ['::redirectOnSubmit'],
      '#redirect' => 'discard_changes',
    ];
    
$form['menu_parent']['#title'] = $this->t('Parent link');
    $form['menu_parent']['#description'] = $this->t('The maximum depth for a link and all its children is fixed. Some menu links may not be available as parents if selecting them would exceed this limit.');
    $form['menu_parent']['#attributes']['class'][] = 'menu-title-select';

    return $form;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form$form_state);
    $element['submit']['#button_type'] = 'primary';
    $element['delete']['#access'] = $this->entity->access('delete');

    return $element;
  }

  /** * {@inheritdoc} */
  public function buildEntity(array $form, FormStateInterface $form_state) {
    /** @var \Drupal\menu_link_content\MenuLinkContentInterface $entity */
    
if (isset($form['source_dependent']['source_configuration'])) {
      // Let the selected plugin save its settings.       $this->entity->getSource()->submitConfigurationForm($form['source_dependent']['source_configuration']$this->getSourceSubFormState($form$form_state));
    }
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);

    // If the media source has not been chosen yet, turn the submit button into     // a button. This rebuilds the form with the media source's configuration     // form visible, instead of saving the media type. This allows users to     // create a media type without JavaScript enabled. With JavaScript enabled,     // this rebuild occurs during an AJAX request.     // @see \Drupal\media\MediaTypeForm::ajaxHandlerData()     if (empty($this->getEntity()->get('source'))) {
      $actions['submit']['#type'] = 'button';
    }

    
      // with page title.       $form['settings']['label']['#title'] = $this->t("Block title");
      $form['settings']['label_display']['#title'] = $this->t("Display block title");
    }
    return $form;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['submit']['#value'] = $this->t('Save @block', ['@block' => $this->entity->getPlugin()->getPluginDefinition()['admin_label']]);
    $actions['delete']['#access'] = FALSE;
    return $actions;
  }

  /** * {@inheritdoc} */
  protected function buildVisibilityInterface(array $form, FormStateInterface $form_state) {
    // Do not display the visibility.     return [];
  }
if (isset($form['language'])) {
      $form['language']['negate']['#type'] = 'value';
      $form['language']['negate']['#value'] = $form['language']['negate']['#default_value'];
    }
    return $form;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['submit']['#value'] = $this->t('Save block');
    $actions['delete']['#title'] = $this->t('Remove block');
    return $actions;
  }

  /** * {@inheritdoc} */
  public function validateForm(array &$form, FormStateInterface $form_state) {
    parent::validateForm($form$form_state);

    
// Do not allow anonymous users to send themselves a copy, because it can       // be abused to spam people.       '#access' => $user->isAuthenticated(),
    ];
    return $form;
  }

  /** * {@inheritdoc} */
  public function actions(array $form, FormStateInterface $form_state) {
    $elements = parent::actions($form$form_state);
    $elements['submit']['#value'] = $this->t('Send message');
    $elements['preview'] = [
      '#type' => 'submit',
      '#value' => $this->t('Preview'),
      '#submit' => ['::submitForm', '::preview'],
      '#access' => !empty($form_state->getStorage()['form_display']->getComponent('preview')),
    ];
    return $elements;
  }

  /** * Form submission handler for the 'preview' action. */

      '#access' => $is_admin,
    ];

    return parent::form($form$form_state);
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form$form_state);
    /** @var \Drupal\comment\CommentInterface $comment */
    $comment = $this->entity;
    $entity = $comment->getCommentedEntity();
    $field_definition = $this->entityFieldManager->getFieldDefinitions($entity->getEntityTypeId()$entity->bundle())[$comment->getFieldName()];
    $preview_mode = $field_definition->getSetting('preview');

    // No delete action on the comment form.     unset($element['delete']);

    // Mark the submit action as the primary action, when it appears.     $element['submit']['#button_type'] = 'primary';

    
// Start with the default user account fields.     $form = parent::form($form$form_state);

    return $form;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form$form_state);
    $element['submit']['#value'] = $this->t('Create new account');
    return $element;
  }

  /** * {@inheritdoc} */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $admin = $form_state->getValue('administer_users');

    if (!\Drupal::config('user.settings')->get('verify_mail') || $admin) {
      
$this->layoutTempstoreRepository->delete($this->sectionStorage);
    $this->messenger()->addStatus($this->t('The layout override has been saved.'));
    $form_state->setRedirectUrl($this->sectionStorage->getRedirectUrl());
    return $return;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['#attributes']['role'] = 'region';
    $actions['#attributes']['aria-label'] = $this->t('Layout Builder tools');
    $actions['submit']['#value'] = $this->t('Save layout');
    $actions['delete']['#access'] = FALSE;
    $actions['#weight'] = -1000;

    $actions['discard_changes'] = [
      '#type' => 'submit',
      '#value' => $this->t('Discard changes'),
      '#submit' => ['::redirectOnSubmit'],
      '#redirect' => 'discard_changes',
      
'#type' => 'value',
      '#value' => $term->id(),
    ];

    return parent::form($form$form_state);
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $element = parent::actions($form$form_state);
    if (!$this->getRequest()->query->has('destination')) {
      $element['overview'] = [
        '#type' => 'submit',
        '#value' => $this->t('Save and go to list'),
        '#weight' => 20,
        '#submit' => array_merge($element['submit']['#submit']['::overview']),
        '#access' => $this->currentUser()->hasPermission('access taxonomy overview'),
      ];
    }

    return $element;
  }
return $this->hasAnyRequired($element[$child]);
      }
    }

    return $has_required;
  }

  /** * {@inheritdoc} */
  protected function actions(array $form, FormStateInterface $form_state) {
    $actions = parent::actions($form$form_state);
    $actions['submit']['#value'] = $this->t('Save settings');

    if (!$this->entity->isNew()) {
      $target_entity_type = $this->entityTypeManager->getDefinition($this->entity->getTargetEntityTypeId());
      $route_parameters = [
        'field_config' => $this->entity->id(),
      ] + FieldUI::getRouteBundleParameter($target_entity_type$this->entity->getTargetBundle());
      $url = new Url('entity.field_config.' . $target_entity_type->id() . '_field_delete_form', $route_parameters);

      if ($this->getRequest()->query->has('destination')) {
        $query = $url->getOption('query');
        
Home | Imprint | This part of the site doesn't use cookies.