Fork me on GitHub
Current release is 2.1.5 (31 Oct 2014).

Users who have not yet upgraded to 2.1 should get security release 2.0.18.14 (1 Nov 2014). We will stop providing these security releases to 2.0 at the end of this year.

[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.