Call Back

Navigation:  Development > MVC (Model View Controller) > View > Theme >

Call Back

Previous pageReturn to chapter overviewNext page

A theme has some call back function. These functions help to check the environment of the theme. In definition xml file we setup a callback location:
 
<callback>Development_View_Rainbow_Definition_Register</callback>

 

This actually a class name in below location:
 
/development/view/rainbow/definition/register.php

 

There are three call back function that execute in different events:
 
before_theme_install()

after_theme_installed()

on_theme_removed()

 
These functions run before, after and on theme remove event. Each function receive an environment variable $send with theme information. See below example:

 

class Development_View_Rainbow_Definition_Register extends appRain_Base_Objects
{
   const SLIDESHOWNAME = 'appslide';
   
   public function before_theme_install($send=null){
   }
   
   public function after_theme_installed($send=null){
   
      if(App::Module('Component')->exists(self::SLIDESHOWNAME)){
         if(App::Component(self::SLIDESHOWNAME)->status() == appRain_Base_Modules_component::INACTIVE){
            App::Component(self::SLIDESHOWNAME)->chnageStatus();
         }
         App::Config()->setSiteInfo('appslidesettings_displaymode','cyclebased');
      }
   }
 
   public function on_theme_removed($send=null){
   }
}

 

Above example set proper slide show for the theme.