public function RelToAbs::process in Relative Path to Absolute URLs 8
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/ RelToAbs.php, line 22
Class
- RelToAbs
- Provides a filter to convert relative paths to absolute URLs.
Namespace
Drupal\rel_to_abs\Plugin\FilterCode
public function process($text, $langcode) {
$base_url = \Drupal::url('<front>', array(), array(
'absolute' => TRUE,
'language' => \Drupal::getContainer()
->get('language_manager')
->getLanguage($langcode),
));
$text = $this
->absoluteUrl($text, $base_url);
return new FilterProcessResult($text);
}