public function ajaxDoDeleteProfile()
 {
     if (Tools::getValue('id_pagebuilderprofile')) {
         $profile = new PsPagebuilderprofile(Tools::getValue('id_pagebuilderprofile'));
         if (!$profile->isDefault()) {
             $profile->delete();
         }
     }
     $output = new stdClass();
     $output->delete = 1;
     $output->id = (int) Tools::getValue('id_pagebuilderprofile');
     echo Tools::jsonEncode($output);
     exit;
 }
 /**
  *
  */
 public function processHook($isfootter = false)
 {
     $cgtheme = _PS_MODE_DEMO_ ? $this->getCustomConfig('themeskin', $this->getThemeConfig('theme')) : $this->getThemeConfig('theme');
     if (Tools::isSubmit('applyCustomSkinChanger') || Tools::getIsset('themeskinactived')) {
         $cgtheme = Tools::getValue('themeskin');
     }
     $pbkey = $isfootter ? $this->getThemeConfig($cgtheme . 'fbuilder') : $this->getThemeConfig($cgtheme . 'pbuilder');
     if (!$this->isCached('pspagebuilder.tpl', $this->getCacheId(null, null, $pbkey))) {
         $id = $pbkey ? PsPagebuilderprofile::getIdByKey($pbkey) : PsPagebuilderprofile::getDefaultProfile();
         $profile = new PsPagebuilderprofile($id, $this->context->language->id);
         $layout = $profile->getLayout();
         if (!empty($layout)) {
             $profile->loadWidgets();
             $ws = $profile->getWidgets();
             $layout = $this->buildLayoutData($layout, $ws, $profile, 1);
         }
         $dir = _PS_MODULE_DIR_ . 'pspagebuilder/views/templates/hook/builderlayout.tpl';
         $tdir = _PS_ALL_THEMES_DIR_ . _THEME_NAME_ . '/modules/pspagebuilder/views/templates/hook/builderlayout.tpl';
         if (file_exists($tdir)) {
             $dir = $tdir;
         }
         $this->smarty->assign(array('layout' => $layout, 'layout_tpl' => $dir, 'prefix' => $isfootter ? 'footerbuilder' : 'pagebuilder'));
     }
     return $this->display(__FILE__, 'pspagebuilder.tpl', $this->getCacheId(null, null, $pbkey));
 }