function FilterFormatEditForm::form

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

Overrides FilterFormatFormBase::form

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.