You are here

public function ShortcodeCorrector::process in Shortcode 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Filter/ShortcodeCorrector.php \Drupal\shortcode\Plugin\Filter\ShortcodeCorrector::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.

Return value

\Drupal\filter\FilterProcessResult The filtered text, wrapped in a FilterProcessResult object, and possibly with associated assets, cacheability metadata and placeholders.

Overrides FilterInterface::process

See also

\Drupal\filter\FilterProcessResult

File

src/Plugin/Filter/ShortcodeCorrector.php, line 32

Class

ShortcodeCorrector
Filter that corrects html added by wysiwyg editors around shortcodes.

Namespace

Drupal\shortcode\Plugin\Filter

Code

public function process($text, $langcode) {
  if (!empty($text)) {

    /** @var \Drupal\shortcode\Shortcode\ShortcodeService $shortcodeEngine */
    $shortcodeEngine = \Drupal::service('shortcode');
    $text = $shortcodeEngine
      ->postprocessText($text, $langcode, $this);
  }
  return new FilterProcessResult($text);
}