Fork me on GitHub
Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Critical: Update to 2.1.8, released 15 Jan.

[Documentation] Can I override a plugin's view in a custom theme?

I'm working on a theme, and I'd like to change the functionality of the Tagging plugin. Namely, I'd like to override class.tagmodule.php in my theme.

I know I can override the views in my theme, but what is the practice for overriding plugin modules like this?

Best Answers

  • mcu_hqmcu_hq yippie ki-yay ✭✭✭
    Answer ✓

    ZacharyLewis said:
    Do themes not allow that functionality?

    I don't think they do.

  • x00x00 MVP
    Answer ✓

    I provide this functionality on some of my plugins, especial where I am already overriding core views.

    It is not a standard thing though, But I support it in principle, as it is consistent with application views

    The principle of it is like so

        $PluginFolder = basename(dirname(__FILE__));
        $ThemeFolder = strtolower($PluginFolder);
        $Sender->ControllerName='';
        $Sender->ControllerFolder='';
        $ThemeViewLoc = CombinePaths(array(
            PATH_THEMES, $Sender->Theme,'views', $ThemeFolder
        ));
        if(file_exists($ThemeViewLoc.DS.strtolower($Sender->RequestMethod).'.php')){
            $Sender->ApplicationFolder= '';
            $Sender->ControllerName=$ThemeFolder;
        }else{
            $Sender->ApplicationFolder='plugins/'.$PluginFolder;
        }
    

    I use lower case folders within themes views folder as this is consistent with the current style

    grep is your friend.

    UnderDog

Answers

Sign In or Register to comment.