public function TestInterpreter::interpret in Recurring Dates Field 3.x
Same name and namespace in other branches
- 8.2 tests/modules/date_recur_interpreter_test/src/Plugin/DateRecurInterpreter/TestInterpreter.php \Drupal\date_recur_interpreter_test\Plugin\DateRecurInterpreter\TestInterpreter::interpret()
- 3.0.x tests/modules/date_recur_interpreter_test/src/Plugin/DateRecurInterpreter/TestInterpreter.php \Drupal\date_recur_interpreter_test\Plugin\DateRecurInterpreter\TestInterpreter::interpret()
- 3.1.x tests/modules/date_recur_interpreter_test/src/Plugin/DateRecurInterpreter/TestInterpreter.php \Drupal\date_recur_interpreter_test\Plugin\DateRecurInterpreter\TestInterpreter::interpret()
Interpret a set of rules in a language.
Parameters
\Drupal\date_recur\DateRecurRuleInterface[] $rules: The rules.
string $language: The two-letter language code.
\DateTimeZone|null $timeZone: Time zone to display dates in. Time zone from rules is not used because time zone used to calculate recurring dates may be different. Use null for default PHP time zone.
Return value
string Rules interpreted into a string.
Overrides DateRecurInterpreterPluginInterface::interpret
File
- tests/
modules/ date_recur_interpreter_test/ src/ Plugin/ DateRecurInterpreter/ TestInterpreter.php, line 33
Class
- TestInterpreter
- Provides an interpreter for testing.
Namespace
Drupal\date_recur_interpreter_test\Plugin\DateRecurInterpreterCode
public function interpret(array $rules, string $language, ?\DateTimeZone $timeZone = NULL) : string {
$pluginConfig = $this
->getConfiguration();
if ($pluginConfig['show_foo']) {
return 'foo';
}
else {
return 'bar';
}
}