Browse By

Solution – Php Filter Module Not Exist in Drupal 8 ?

Due to security reasons, php filter module has been removed from Drupal 8. Thus It becomes very difficult to add php scripts in blocks and nodes without editing templates. To overcome this problem we have created our own module and pushed it as sandbox project in Drupal.org

Php Shortcode – This modules provides shortcode option to execute php scripts inside blocks and nodes.

Dependencies:- Shortcode module

Project URL:- https://www.drupal.org/sandbox/niyas/2780793

Please follow the steps below to use this module:-

1) Install and enable ‘Php Shortcode’ Module.

2) Go to Configuration > Content Authoring > Text Formats.

(Recommended: Drupal 8 Explained: Your Step-by-Step Guide to Drupal 8)

3)Find the input format (Ex: Php filter) you want to enable the shortcode for and click on Configure in that row.

4) Enable the shortcode filter Shortcodes.

5) Under Filter settings, check the checkbox next to ‘Enable Php Code Shortcode’.

6) Save the settings.

You’re done. Now If you go and create any custom block you would notice helpful tip below the WYSIWYG editor. It will help users on how to use the php shortcode.

Php filter drupal 8 shortcode module demo

After saving the block, Here is the output:-Php filter drupal 8

Please try this module by downloading here and let us know if you have any questions. Hopefully it servers as better alternative for php filter.

Leave a Reply

%d bloggers like this: