Jump to:

23450 Posts in 18899 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Module themes 2.4.0

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1040 Views
  • paul.mcilwaine
    Avatar
    Community Member
    21 Posts

    Module themes 2.4.0 Link to this post

    I was previously using 2.3.4 of silverstripe with a theme that worked with a module that I created e.g.

    mymodule

    themes/mythemename_mymodule

    However after upgrading to 2.4.0 the mythemename_mymodule no longer works (I rebuilt the project to see if this would fix it). However on my development machine all is fine and works as it should. The issue seems to be affecting my staging server and cannot figure out what the issue is. Ive rebuilt the project on my development machine and still works correctly so something is different on the staging server but unsure as to what.

    Has anyone run into similar problems ? What I do know is the manifest-main file doesnt recognise the mythemename_mymodule directory at all which im scratching my head about as file permissions are fine.

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Module themes 2.4.0 Link to this post

    mythemename_mymodule works into 2.4, too. Error?

  • paul.mcilwaine
    Avatar
    Community Member
    21 Posts

    Re: Module themes 2.4.0 Link to this post

    Ok Ive done some more testing, and Im really puzzled by why this is happening.

    I checked the ManifestBuilder class with some basic tests to see what was happening on line 330 I added this

    if ( isset( $templateManifest[$templateName]['themes'][$themeName][$templateType] ) ) var_dump( $templateManifest[$templateName]['themes'][$themeName][$templateType] );

    To see if a template was already in the Manifest and if it was output what was currently in it. On my development machine this is the normal theme directory files shown (What I expected). On the staging server its the theme_module name. (Reverse order)

    So what is happening is the theme is overwriting the theme_modulename template which is incorrect. I cant think of why the order is different on the staging server as the only difference is Linux is the staging server whilst the dev is a Mac. It was working perfectly prior to upgrading but cant find any major differences in the ManifestBuilder to make this kind of change, I havent made changes to the linux server either which could maybe show any reasons as to why.

  • paul.mcilwaine
    Avatar
    Community Member
    21 Posts

    Re: Module themes 2.4.0 Link to this post

    Ok seems Ive fixed it for now, unsure how good a fix it is though.

    public static function get_themes($baseDir = null, $includeSubThemes = false) {
          // If no base directory specified, the default is the project root
          if(!$baseDir) $baseDir = BASE_PATH . DIRECTORY_SEPARATOR . THEMES_DIR;
          $themes = array();
          if(!file_exists($baseDir)) return $themes;
          
          $cwd = getcwd();
          chdir( $baseDir );
          $files = glob( "*", GLOB_ONLYDIR );
          
          if ( $files )
          {
             foreach ( $files as $file )
             {
                $fullPath = $baseDir . DIRECTORY_SEPARATOR . $file;
                if(strpos($file, '.') === false && is_dir($fullPath)) {
                   $include = $includeSubThemes ? true : false;
                   if(strpos($file, '_') === false) {
                      $include = true;
                   }
                   if($include) $themes[$file] = $file;
                }
             }
          }
          chdir( $cwd );
          return $themes;
       }

    1040 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.