Sage and Color Schemes ("light" and "dark" version, for example)

I also found a way to conditionally load controllers, so I can change things like the logo, site name, and other controller-like things. Check it out:

theme-name/app/controllers/App.php

<?php

namespace App;

use Sober\Controller\Controller;

class App extends Controller {

  /**
   * Scheme specific traits
   */

   use Light;
   use Dark;

/**
* Global controller stuff goes here
*/

}

theme-name/app/controllers/partials/light.php

<?php

namespace App;

use Sober\Controller\Controller;

if(get_theme_mod( 'subtheme_setting') == 'light' ) {
  trait Light {

    /**
     * Logo
     * @return Logo URL
     */
    public function logo() {
      return asset_path('images/logos/logo-light.png');
    }

  }

} else {
  trait Light { }
}
5 Likes