class FilterTestReplace

Provides a test filter to replace all content.

Plugin annotation


@Filter(
  id = "filter_test_replace",
  module = "filter_test",
  title = @Translation("Testing filter"),
  description = @Translation("Replaces all content with filter and text format information."),
  type = FILTER_TYPE_TRANSFORM_IRREVERSIBLE
)

Hierarchy

Expanded class hierarchy of FilterTestReplace

File

drupal/core/modules/filter/tests/filter_test/lib/Drupal/filter_test/Plugin/Filter/FilterTestReplace.php, line 25
Contains \Drupal\filter_test\Plugin\Filter\FilterTestReplace.

Namespace

Drupal\filter_test\Plugin\Filter
View source
class FilterTestReplace extends FilterBase {

  /**
   * {@inheritdoc}
   */
  public function process($text, $langcode, $cache, $cache_id) {
    $text = array();
    $text[] = 'Filter: ' . $this
      ->getLabel() . ' (' . $this
      ->getPluginId() . ')';
    $text[] = 'Language: ' . $langcode;
    $text[] = 'Cache: ' . ($cache ? 'Enabled' : 'Disabled');
    if ($cache_id) {
      $text[] = 'Cache ID: ' . $cache_id;
    }
    return implode("<br />\n", $text);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FilterBase::$bag protected property A collection of all filters this filter participates in.
FilterBase::$cache public property A Boolean indicating whether the text processed by this filter may be cached.
FilterBase::$module public property The name of the module that owns this filter.
FilterBase::$plugin_id protected property The plugin ID of this filter.
FilterBase::$settings public property An associative array containing the configured settings of this filter.
FilterBase::$status public property A Boolean indicating whether this filter is enabled.
FilterBase::$weight public property The weight of this filter compared to others in a filter collection.
FilterBase::export public function Exports the complete configuration of this filter plugin instance. Overrides FilterInterface::export
FilterBase::getDescription public function Returns the administrative description for this filter plugin. Overrides FilterInterface::getDescription
FilterBase::getLabel public function Returns the administrative label for this filter plugin. Overrides FilterInterface::getLabel
FilterBase::getType public function Returns the processing type of this filter plugin. Overrides FilterInterface::getType
FilterBase::prepare public function Prepares the text for processing. Overrides FilterInterface::prepare
FilterBase::setPluginConfiguration public function Sets the configuration for this filter plugin instance. Overrides FilterInterface::setPluginConfiguration
FilterBase::settingsForm public function Generates a filter's settings form. Overrides FilterInterface::settingsForm 2
FilterBase::tips public function Generates a filter's tip. Overrides FilterInterface::tips 6
FilterBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct
FilterTestReplace::process public function Performs the filter processing. Overrides FilterInterface::process
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId