You are here

public function FilterFormatEditForm::form in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/filter/src/FilterFormatEditForm.php \Drupal\filter\FilterFormatEditForm::form()
  2. 10 core/modules/filter/src/FilterFormatEditForm.php \Drupal\filter\FilterFormatEditForm::form()

Gets the actual form array to be built.

Overrides FilterFormatFormBase::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

core/modules/filter/src/FilterFormatEditForm.php, line 18

Class

FilterFormatEditForm
Provides a form for adding a filter format.

Namespace

Drupal\filter

Code

public function form(array $form, FormStateInterface $form_state) {
  if (!$this->entity
    ->status()) {
    throw new NotFoundHttpException();
  }
  $form['#title'] = $this->entity
    ->label();
  $form = parent::form($form, $form_state);
  $form['roles']['#default_value'] = array_keys(filter_get_roles_by_format($this->entity));
  return $form;
}