You are here

public static function CustomFilterBaseFilter::replaceCallback in Custom filter 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Filter/CustomFilterBaseFilter.php \Drupal\customfilter\Plugin\Filter\CustomFilterBaseFilter::replaceCallback()

Helper function for preg_replace_callback().

1 call to CustomFilterBaseFilter::replaceCallback()
CustomFilterBaseFilter::applyRules in src/Plugin/Filter/CustomFilterBaseFilter.php
Replace the text using rules.

File

src/Plugin/Filter/CustomFilterBaseFilter.php, line 178

Class

CustomFilterBaseFilter
Provides a base filter for Custom Filter.

Namespace

Drupal\customfilter\Plugin\Filter

Code

public static function replaceCallback($matches, $init = FALSE) {
  static $code;
  if ($init) {
    $code = $matches;
    return '';
  }
  static::getCodeVars();

  // phpcs:ignore
  @eval($code);
  return isset($result) ? $result : '';
}