![]() ![]() ![]() The Absolutely Wrong Way for PHP Codeĭo not try to use the PHP Code Filter module under any circumstances! This module used to let you put PHP Code directly into CKEditor and have it get processed when the page is displayed. Thus, you could implement a block that has your external embed code or custom PHP code output as its content, then place that block on whichever page you want the output to show. These will act like a custom block that you create in the Block Layout interface, only the content will be generated by your module instead of being entered through the Drupal user interface. The Drupal organization has made some tutorials available to help get you started:įor a lot of cases, the right approach is to create a module that implements its own dynamic block(s). This does require a reasonable amount of PHP coding experience and time to get familiar with how to code for Drupal. The Preferred Way for PHP Codeīy far, the recommended way of adding custom PHP Code to a page of a Drupal site is by creating a custom module, which is a type of plugin that adds extra functionality to your Drupal site. You can then add blocks where needed and use this new text format so that you can add your embed code to the block. You'll then want to restrict this format to site administrators (which should hopefully be a separate role from that of your site's day-to-date content creators and editors). If the service you want to embed from also requires you to include a snippet of JavaScript, then you'll need to enable that for your new text format as well. If you haven't added any tools to restrict this, then you're all set.įor more restrictive CKEditor configurations, such as the GT Editor version of CKEditor for Drupal 7, you'll need to add a new text format ( Configuration -> Content authoring -> Text formats and editors) that at a minimum allows IFRAME embeds. The "Full HTML" format in an out-of-the-box installation of Drupal 9, or in Drupal 7 with CKEditor installed without the WYSIWYG plugin should already allow for IFRAME embeds and JavaScript embeds. The Easy Way for IFRAME and JavaScript Embeds ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |