You are here

public function FilterPathologic::process in Pathologic 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/FilterPathologic.php, line 82

Class

FilterPathologic
Attempts to correct broken paths in content.

Namespace

Drupal\pathologic\Plugin\Filter

Code

public function process($text, $langcode) {
  $settings = $this->settings;
  if ($settings['settings_source'] === 'global') {
    $config = \Drupal::config('pathologic.settings');
    $settings['protocol_style'] = $config
      ->get('protocol_style');
    $settings['local_paths'] = $config
      ->get('local_paths');
  }
  else {
    $settings = $settings['local_settings'];
  }

  // @todo Move code from .module file to inside here.
  return new FilterProcessResult(_pathologic_filter($text, $settings, Crypt::hashBase64(serialize($settings))));
}