3 namespace Drupal\filter;
5 use Drupal\Core\Form\FormStateInterface;
6 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9 * Provides a form for adding a filter format.
13 class FilterFormatEditForm extends FilterFormatFormBase {
18 public function form(array $form, FormStateInterface $form_state) {
19 if (!$this->entity->status()) {
20 throw new NotFoundHttpException();
23 $form['#title'] = $this->entity->label();
24 $form = parent::form($form, $form_state);
25 $form['roles']['#default_value'] = array_keys(filter_get_roles_by_format($this->entity));
32 public function submitForm(array &$form, FormStateInterface $form_state) {
33 parent::submitForm($form, $form_state);
34 $this->messenger()->addStatus($this->t('The text format %format has been updated.', ['%format' => $this->entity->label()]));