Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Have you ever been typing out a big block of content with a WYSIWYG and really wanted to use a dynamic date or date range, or to use a link within your site but you know the subdirectory on the hostname will break links on your development sites? A simple PHP or Drupal function would get the job done nicely, but I don't want to have to write the whole page using the PHP Filter!
This module lets you embed a couple of simple PHP functions into your content without giving your IT department a heart attack.
Currently there are three functions supported:
format_date()
format_interval()
l()
The data is scrubbed and validated before being passed into the function to generate the PHP return value.
Modules may also hook into this filter by providing their own validation hook for a given php function.
If you have any other common functions that you would like to see incorporated, please submit them through the issue queue and I will try my best to integrate them. Even better, include a patch with your additions!
Use Cases
Explain a limiting date. "Your purchase with expire in 2 weeks on [php|format_date{+2 weeks|small}].
Experiment to provide a generic slideshow element. The field_slideshow and views_slideshow modules modules could depend on it and provide only specific integration.