/** * Handle the shortcode genrator section. * if request is made via ajax, a json encoded string is echoed * * @return string */ public function handleGeneratorSection() { if ($this->isMethod('POST') && $this->generator->hasRequest()) { $this->removeCache('generatorSection'); $this->generator->bind(filter_input_array(INPUT_POST)); if ($this->generator->isValid()) { $loginButton = $this->generator->getData(); $this->setListenerResponse($this->render($this->container->getRoot()->getRootPath() . '/Resources/views/admin/generator.html.php', array('phpCode' => $this->loginButtonManager->generatePhpCode($loginButton), 'shortcode' => $this->loginButtonManager->generateShorcode($loginButton)))); } if ($this->isAjaxRequest()) { $this->renderJson(array('view' => $this->generatorSection()), true); exit; } } }