Fork me on GitHub
Current Releases are 2.1 stable (major release) and 2.0.18.11 (security patch for 2.0)
We've also rebooted our GitHub repo, docs, and more!

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

edited April 2012 in Questions

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.