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.
11 class FilterFormatEditForm extends FilterFormatFormBase {
16 public function form(array $form, FormStateInterface $form_state) {
17 if (!$this->entity->status()) {
18 throw new NotFoundHttpException();
21 $form['#title'] = $this->entity->label();
22 $form = parent::form($form, $form_state);
23 $form['roles']['#default_value'] = array_keys(filter_get_roles_by_format($this->entity));
30 public function submitForm(array &$form, FormStateInterface $form_state) {
31 parent::submitForm($form, $form_state);
32 drupal_set_message($this->t('The text format %format has been updated.', ['%format' => $this->entity->label()]));