You are here

public function Shortcode::process in Shortcode 2.0.x

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

Class

Shortcode
Provides a filter for insert view.

Namespace

Drupal\shortcode\Plugin\Filter

Code

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

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