/** * execute the jquery service init method. * * @param string $InfoService service information ex : "contenaireName:NameServiceValidator" * * @static * @return void * @access public * @author Etienne de Longeaux <*****@*****.**> */ public final function initJquery($InfoService) { $infos = explode(":", $InfoService); if (count($infos) <= 1) { throw ServiceException::serviceParameterUndefined($InfoService); } if (count($infos) == 2) { $container = $infos[0]; $NameServiceValidator = $infos[1]; $options = null; } elseif (count($infos) == 3) { $container = $infos[0]; $NameServiceValidator = $infos[1]; $options = $infos[2]; } if ($this->isServiceSupported($container, $NameServiceValidator)) { $this->container->get($this->service)->init($options); } }
/** * execute the Widget service init method. * * @param string $InfoService service information ex : "contenaireName:actionName" * @return void * @access public * @final * * @author (c) Etienne de Longeaux <*****@*****.**> */ public final function initWidget($InfoService) { $method = ""; $infos = explode(":", $InfoService); // if (count($infos) <= 1) { throw ServiceException::serviceParameterUndefined($InfoService); } $container = $infos[0]; $actionName = $infos[1]; // if (!in_array($container, array('css', 'js'))) { if (count($infos) == 3) { $method = $infos[2]; } if (count($infos) == 4) { $method = $infos[2] . ":" . $infos[3]; } if ($this->isServiceSupported($container, $actionName)) { if (method_exists($this->getServiceWidget(), 'init')) { $this->getServiceWidget()->setMethod($method); $this->getServiceWidget()->init(); } } } else { if ($container == "css") { $all_css = json_decode($actionName); foreach ($all_css as $path_css) { $this->container->get('sfynx.tool.twig.extension.layouthead')->addCssFile($path_css, 'append'); } } elseif ($container == "js") { $all_js = json_decode($actionName); foreach ($all_js as $path_js) { $this->container->get('sfynx.tool.twig.extension.layouthead')->addJsFile($path_js, 'append'); } } } }