protectBundleIdElement example

'#default_value' => ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', $vocabulary->id()),
      ];
    }
    // Set the hierarchy to "multiple parents" by default. This simplifies the     // vocabulary form and standardizes the term form.     $form['hierarchy'] = [
      '#type' => 'value',
      '#value' => '0',
    ];

    $form = parent::form($form$form_state);
    return $this->protectBundleIdElement($form);
  }

  /** * {@inheritdoc} */
  public function save(array $form, FormStateInterface $form_state) {
    $vocabulary = $this->entity;

    // Prevent leading and trailing spaces in vocabulary names.     $vocabulary->set('name', trim($vocabulary->label()));

    
'#type' => 'details',
      '#title' => $this->t('Display settings'),
      '#group' => 'additional_settings',
    ];
    $form['display']['display_submitted'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Display author and date information'),
      '#default_value' => $type->displaySubmitted(),
      '#description' => $this->t('Author username and publish date will be displayed.'),
    ];

    return $this->protectBundleIdElement($form);
  }

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

  


      $form['#submit'][] = 'language_configuration_element_submit';
    }

    $form['actions'] = ['#type' => 'actions'];
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Save'),
    ];

    return $this->protectBundleIdElement($form);
  }

  /** * {@inheritdoc} */
  public function save(array $form, FormStateInterface $form_state) {
    $block_type = $this->entity;
    $status = $block_type->save();

    $edit_link = $this->entity->toLink($this->t('Edit'), 'edit-form')->toString();
    $logger = $this->logger('block_content');
    
'source' => ['label'],
        'replace_pattern' => '[^a-z0-9-]+',
        'replace' => '-',
      ],
      '#default_value' => $entity->id(),
      // This id could be used for menu name.       '#maxlength' => 23,
    ];

    $form['actions']['submit']['#value'] = $this->t('Create new set');

    return $this->protectBundleIdElement($form);
  }

  /** * {@inheritdoc} */
  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this->entity;
    $is_new = !$entity->getOriginalId();
    $entity->save();

    if ($is_new) {
      
Home | Imprint | This part of the site doesn't use cookies.