You are here

public static function CustomFilterBaseFilter::getGlobals in Custom filter 8

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

Return an object with global variables used during the execution of a rule.

2 calls to CustomFilterBaseFilter::getGlobals()
CustomFilterBaseFilter::applyRules in src/Plugin/Filter/CustomFilterBaseFilter.php
Replace the text using rules.
CustomFilterBaseFilter::process in src/Plugin/Filter/CustomFilterBaseFilter.php
Performs the filter processing.

File

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

Class

CustomFilterBaseFilter
Provides a base filter for Custom Filter.

Namespace

Drupal\customfilter\Plugin\Filter

Code

public static function &getGlobals($op = '') {
  static $globals = array(), $index = 0;
  if ($op == 'push') {
    $globals[++$index] = new \stdClass();
  }
  elseif ($op == 'pop' && $index) {
    unset($globals[$index--]);
  }
  return $globals[$index];
}