removeFilter example

/** * {@inheritdoc} */
  public function onDependencyRemoval(array $dependencies) {
    $changed = parent::onDependencyRemoval($dependencies);
    $filters = $this->filters();
    foreach ($filters as $filter) {
      // Remove disabled filters, so that this FilterFormat config entity can       // continue to exist.       if (!$filter->status && in_array($filter->provider, $dependencies['module'])) {
        $this->removeFilter($filter->getPluginId());
        $changed = TRUE;
      }
    }
    return $changed;
  }

  /** * {@inheritdoc} */
  protected function calculatePluginDependencies(PluginInspectionInterface $instance) {
    // Only add dependencies for plugins that are actually configured. This is
    // installed. For example, editor.editor.basic_html is editor configuration     // that depends on the CKEditor 5 module. The CKEditor 5 module can not be     // installed before the editor module since it depends on the editor module.     // The installer does not have this limitation since it ensures that all of     // the install profiles dependencies are installed before creating the     // editor configuration.     foreach (FilterFormat::loadMultiple() as $filter) {
      // Ensure that editor can be uninstalled by removing use in filter       // formats. It is necessary to prime the filter collection before removing       // the filter.       $filter->filters();
      $filter->removeFilter('editor_file_reference');
      $filter->save();
    }
    \Drupal::service('module_installer')->uninstall(['editor', 'ckeditor5']);
    $this->rebuildContainer();
    \Drupal::service('module_installer')->install(['editor']);
    /** @var \Drupal\contact\ContactFormInterface $contact_form */
    $contact_form = ContactForm::load('feedback');
    $recipients = $contact_form->getRecipients();
    $this->assertEquals(['simpletest@example.com']$recipients);

    $role = Role::create([
      
public static function registration(): void
    {
        if (static::$registered) {
            static::$registered = stream_filter_register('CITestStreamFilter', self::class); // @codeCoverageIgnore         }

        static::$buffer = '';
    }

    public static function addErrorFilter(): void
    {
        self::removeFilter(self::$err);
        self::$err = stream_filter_append(STDERR, 'CITestStreamFilter');
    }

    public static function addOutputFilter(): void
    {
        self::removeFilter(self::$out);
        self::$out = stream_filter_append(STDOUT, 'CITestStreamFilter');
    }

    public static function removeErrorFilter(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.