Skip to content

getSubscribedEvents() in Theme is not called if the class ends with 'Theme' #1047

Closed
@chvelkov

Description

Hello,

I encountered the following problem, while trying to figure out why getSubscribedEvents() in my theme file was not called.

The dev-tools plugin adds the string 'Theme' to the end of the class name when creating a new theme.
E.g.

class TestTheme extends Theme
{
    public static function getSubscribedEvents() {
        exit('Never gets called');
        return[];
    }

}

The problem is that with 'Theme' at the end, the getSubscribedEvents() is never called.
I had to manually rename the class and remove the 'Theme' to get it called:

class Test extends Theme
{
    public static function getSubscribedEvents() {
        exit('This will be called');
        return[];
    }

}

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions