public function FilterTestReplace::process

Performs the filter processing.

Parameters

string $text: The text string to be filtered.

string $langcode: The language code of the text to be filtered.

bool $cache: A Boolean indicating whether the filtered text is going to be cached in {cache_filter}.

string $cache_id: The ID of the filtered text in {cache_filter}, if $cache is TRUE.

Return value

string The filtered text.

Overrides FilterInterface::process

File

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

Class

FilterTestReplace
Provides a test filter to replace all content.

Namespace

Drupal\filter_test\Plugin\Filter

Code

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