public function ReportReplacer::__construct in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/Token/ReportReplacer.php \Drupal\forena\Token\ReportReplacer::__construct()
Parameters
$regexp: Regular expression used to find the tokens.
string $trim: Characters used to remove from the regular expression.
null $formatter: Object contaning the formatter method.
Overrides TokenReplacerBase::__construct
File
- src/Token/ ReportReplacer.php, line 21 
Class
Namespace
Drupal\forena\TokenCode
public function __construct() {
  parent::__construct('/\\{[^\\n^\\r^}]+}/', '{}');
  $this
    ->setFormatter($this);
  $formatters = AppService::instance()
    ->getFormatterPlugins();
  foreach ($formatters as $class) {
    /** @var FormatterInterface $formatter */
    $formatter = new $class();
    $formats = $formatter
      ->formats();
    foreach ($formats as $method => $label) {
      $this->format_callbacks[$method] = array(
        $formatter,
        $method,
      );
      $this->formats[$method] = $label;
    }
  }
}