Bug #23219 See Comments

Nested plugins are not parsed before outer modules.

Version: 3.5.11 Reporter: shilpam05

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

The cause of this issue is line 1543 in system/ee/legacy/libraries/Template.php

// Nested Plugins...
       if (in_array($this->tag_data[$i]['class'] , $this->plugins) && strpos($this->tag_data[$i]['block'], LD.'exp:') !== FALSE)

The first part of the if condition is not satisfied because $this->tag_data[$i]['class'] is a module and not a plugin, so it is not in the $this->plugins array.

One possible fix is to change that line to

if ((in_array($this->tag_data[$i]['class'] , $this->plugins) || (in_array($this->tag_data[$i]['class'] , $this->plugins)) && strpos($this->tag_data[$i]['block'], LD.'exp:') !== FALSE)

A workaround is to add a pi.[mod_name].php to the module, so that it is also counted as a plugin.

  • This is by design, please refer to the documentation on using plugins: https://docs.expressionengine.com/latest/templates/plugins.html

    Derek Jones
    07th September, 2017 at 10:46am
  • Is the workaround a valid one?

    We made it a module to add database migrations. Otherwise, we’d use a plugin.

    07th September, 2017 at 10:49am
  • It’s not supported, so it could not be guaranteed to work in the future. Can you elaborate on the tag syntax you are wanting to use in a template that isn’t doing what you expect? We may be able to recommend something that is supported, and therefore future proof.

    Derek Jones
    07th September, 2017 at 10:50am
  • {exp:channel:entries url_title="{segment:amp_url_title}" limit="1"}
    {exp:bb_mod:modify_html}  =====>  Module (because we wanted db migrations via install and update)
                        {exp:ce_img:bulk}  =======> Plugin (needs to be parsed before module function is called)
                            {blog_content}  ========> from entry
    07th September, 2017 at 10:55am
  • By how it’s named, that looks like maybe it should be a plugin. What migrations and db interaction does an add-on have that modifies HTML output, and are you sure it belongs there?

    Derek Jones
    07th September, 2017 at 11:11am
  • We decided to split it up between a plugin and a module, but maybe we can put in a feature request to be able to change parse order between plugins or modules, so we wouldn’t have to split them up if we don’t want to. The module will be used internally only, so we can do that, but if it were for external customers, it would be nice to give them one deliverable instead of 2.

    07th September, 2017 at 2:39pm
  • Rather than just adding options and preferences to cover edge cases, it would be helpful if we understood the underlying issue that led to this point. What does this add-on do? Why is what appears to be a formatting plugin needing interactions with the database? The more detail you can provide, the more likely we are to consider a feature request and be able to solve it in a way that benefits the most people. Thanks!

    Derek Jones
    07th September, 2017 at 2:53pm
  • The addon adds channel fields. It will also have settings in the control panel that can change the behavior of the tag.

    07th September, 2017 at 3:01pm
  • Thanks for the quick reply but that really doesn’t tell us anything. If you ever feel like providing additional details, including functional overview and detailed description of what tasks its tags perform, just drop an email to team@ellislab.com or post to the Feature Request forum.

    Derek Jones
    07th September, 2017 at 3:03pm
  • sounds good

    07th September, 2017 at 3:05pm
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases