/** * Constructor * * @param string $id The ID of the initializer * @param array $data The configuration key/value pairs */ public function __construct($id, $data) { parent::__construct($id, $data); // Boostrap Kirki Hooks::filter('kirki/config', $this, 'configureKirki'); Hooks::filter('customize_register', $this, 'createPanels'); Hooks::filter('kirki/controls', $this, 'registerControls'); /** @noinspection PhpIncludeInspection */ require_once Paths::vendors('aristath/kirki/kirki.php'); }
/** * Constructor * * @param string $id The ID of the initializer * @param array $data The configuration key/value pairs */ public function __construct($id, $data) { parent::__construct($id, $data); // If blade is enabled, include required files if ($this->isBladeEnabled()) { require_once Paths::vendors('autoload.php'); } // Our themes should be properly structured, so we could also provide some common templates within a // different folder Hooks::filter('get_search_form', $this, 'suggestMoreSearchFormTemplates'); }
/** * Hook into WordPress to execute our ajax callback */ protected function registerHooks() { // Our callbacks are registered only on the admin side even for guest and frontend callbacks if (is_admin()) { switch ($this->accessType) { case 'guest': Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax'); break; case 'logged': Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax'); break; case 'any': Hooks::action('wp_ajax_nopriv_' . static::$ACTION, $this, 'doAjax'); Hooks::action('wp_ajax_' . static::$ACTION, $this, 'doAjax'); break; default: throw new \InvalidArgumentException("Invalid value for the Ajax access type parameter: " . $this->accessType); } } // If we have global variables Hooks::filter('baobab/ajax/global_data', $this, 'addGlobalVariables'); }