You are here

public function FilterOEmbed::prepare in oEmbed 8

Prepares the text for processing.

Filters should not use the prepare method for anything other than escaping, because that would short-circuit the control the user has over the order in which filters are applied.

Parameters

string $text: The text string to be filtered.

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

Return value

string The prepared, escaped text.

Overrides FilterBase::prepare

File

src/Plugin/Filter/FilterOEmbed.php, line 106
Contains \Drupal\filter\Plugin\Filter\FilterOEmbed.

Class

FilterOEmbed
Provides a fallback placeholder filter to use for missing filters.

Namespace

Drupal\oembed\Plugin\Filter

Code

public function prepare($text, $langcode) {
  if ($this->settings['autoembed']) {
    $text = preg_replace_callback(self::OEMBED_PATTERN_AUTOEMBED, array(
      $this,
      'oembed_preg_auto_replace',
    ), $text);
  }
  return $text;
}