Skip to content

New Addon template tags breaks entry preview #3594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
acutedeveloper opened this issue Jul 10, 2023 · 1 comment · Fixed by #3601
Closed

New Addon template tags breaks entry preview #3594

acutedeveloper opened this issue Jul 10, 2023 · 1 comment · Fixed by #3601
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@acutedeveloper
Copy link

acutedeveloper commented Jul 10, 2023

Description of the problem

I have created a new template tag by create a new Addon using the eecli and then setting up new template tag using the make:template-tag.

The template tag will output its content fine in the websites templates. However when editing entries in the control panel, the preview pane presents this error:

ExpressionEngine\Service\Addon\Exceptions\ControllerException Caught

Invalid Module request! Are you sure \addonDeveloper\TemplateTag\Actions\Output is setup properly?

ee/ExpressionEngine/Service/Addon/Module.php:72

What testing I have tried

I have created a vanilla addon simply called template tag. I have setup a template tag within that addon with an output method.

This is the content of the Tags/Output.php file

<?php

namespace AcuteDeveloper\TemplateTag\Tags;

use ExpressionEngine\Service\Addon\Controllers\Tag\AbstractRoute;

class Output extends AbstractRoute
{
    // Example tag: {exp:templatetag:output}
    public function process()
    {
        return "My tag";
    }
}

In the frontend templates, it outputs fine. In the control panel previews, the error above is presented.

My setup

  • EE 7.2.6
  • Using structure templates
  • Testing on my local laravel valet environment

I have a _base.html file that is extended by templates in a layout folder.

layouts
     - _base.html
     - _homepage.html

How To Reproduce

  1. Ensure you have templates that you can preview in the entries preview pane
  2. Create a new Addon with make:addon.
  3. Create a new template tag with make:template-tag.
  4. Add your new template tab to your template
  5. Preview the template in a new entry
  6. Error presented

Possible Solution
For now Im trying the older pi.addon_name.php plugin file style.

@intoeetive intoeetive added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Jul 11, 2023
@intoeetive
Copy link
Contributor

@acutedeveloper thank you for reporting this!

Because Live Preview is action request, the Addon service is looking in the wrong place. We'll try to get this fixed in next patch release

intoeetive added a commit that referenced this issue Jul 11, 2023
bryannielsen added a commit that referenced this issue Jul 18, 2023
Resolved #3594 where template tags created from CLI would show error when used in Live Preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
2 participants