public function MomentOperation::moment in Twig Extender 8.2
Same name and namespace in other branches
- 8.4 modules/twig_extender_extras/src/Plugin/TwigPlugin/MomentOperation.php \Drupal\twig_extender_extras\Plugin\TwigPlugin\MomentOperation::moment()
- 8.3 modules/twig_extender_extras/src/Plugin/TwigPlugin/MomentOperation.php \Drupal\twig_extender_extras\Plugin\TwigPlugin\MomentOperation::moment()
- 4.x modules/twig_extender_extras/src/Plugin/TwigPlugin/MomentOperation.php \Drupal\twig_extender_extras\Plugin\TwigPlugin\MomentOperation::moment()
Possibility to add or substract days or weeks ...
Parameters
string $date: The element array whose children are to be identified. Passed by reference.
bool $operation: Boolean to indicate whether the children should be sorted by weight.
bool $entry: Boolean to indicate whether the children should be sorted by weight.
bool $number: Boolean to indicate whether the children should be sorted by weight.
bool $timezone: Boolean to indicate whether the children should be sorted by weight.
Return value
array The filtered array to loop over.
File
- modules/
twig_extender_extras/ src/ Plugin/ TwigPlugin/ MomentOperation.php, line 36
Class
- MomentOperation
- Provide helper methods for Drupal render elements.
Namespace
Drupal\twig_extender_extras\Plugin\TwigPluginCode
public function moment($date, $operation, $entry, $number, $timezone = NULL) {
$moment = $this
->getMoment($date, $timezone);
$funcCall = $operation . ucfirst($entry);
return $moment
->{$funcCall}($number);
}