/** * Return the data for direct output to the frontend, can also contain HTML code! * * @return string */ public function frontend() { $dataAttr = array(); $dataAttr['data-locations'] = json_encode($this->data); $dataAttr['data-mapoption-zoom'] = $this->options['mapZoom']; $dataAttr['data-mapoption-map-type-id'] = $this->options['mapType']; $configNode = Config::getConfig()->googleMap; if (!empty($configNode)) { $mapOptions = $configNode->mapOptions->toArray(); $mapStyleUrl = $configNode->mapStyleUrl; $markerIcon = $configNode->markerIcon; if (is_array($mapOptions) && count($mapOptions) > 0) { foreach ($mapOptions as $name => $value) { $value = is_bool($value) ? $value === TRUE ? 'true' : 'false' : (string) $value; // convert camelCase to camel-case, because we will read these property with $el.data(), which converts them back to camelCase $name = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '-\\1', $name)); $dataAttr['data-mapoption-' . $name] = $value; } } if (!empty($mapStyleUrl)) { $dataAttr['data-mapstyleurl'] = $mapStyleUrl; } if (!empty($markerIcon)) { $dataAttr['data-markericon'] = $markerIcon; } } $dataAttrString = implode(' ', array_map(function ($v, $k) { return $k . "='" . $v . "'"; }, $dataAttr, array_keys($dataAttr))); if (!$this->id) { $this->id = uniqid('map-'); } $html = '<div class="embed-responsive-item toolbox-googlemap" id="' . $this->id . '" ' . $dataAttrString . '></div>'; return $html; }
public function ckeditorStyleAction() { $configFile = PIMCORE_PLUGINS_PATH . '/Toolbox/var/config/backend/ckeditor/defaultStyle.json'; $userConfig = \Toolbox\Config::getConfig()->ckeditor->styles->toArray(); $defaultConfig = json_decode(file_get_contents($configFile), true); $this->view->assign('config', json_encode(array_merge($defaultConfig, $userConfig))); $content = $this->view->render('admin/settings/ckeditor-style.php'); $response = $this->getResponse()->setHeader('Content-Type', 'application/javascript')->appendBody($content); $response->sendResponse(); exit; }
/** * @param $type * @param View $view * * @return string */ public static function buildElementConfig($type, View $view) { $userConfigElements = array(); $configNode = Config::getConfig()->{$type}; if (!empty($configNode)) { $userConfigElements = $configNode->configElements->toArray(); } if (empty($userConfigElements)) { $userConfigElements = array(); } $coreConfigNode = array(); $coreConfig = Config::getCoreConfig(); if (isset($coreConfig->{$type}) && isset($coreConfig->{$type}->configElements)) { $coreConfigNode = $coreConfig->{$type}->configElements->toArray(); } $configElements = array_merge($userConfigElements, $coreConfigNode); if (empty($configElements)) { return ''; } $config = self::parseConfig($type, $configElements, $view); return $view->template('admin/fieldSet.php', array('configElements' => $config)); }
/** * @return array */ private static function getAvailableBricksForSnippets() { $areaElements = self::getActiveBricks(); $disallowedSubAreas = Config::getConfig()->disallowedContentSnippetAreas->toArray(); $bricks = []; foreach ($areaElements as $a) { if (!in_array($a, $disallowedSubAreas)) { $bricks[] = $a; } } $params = array(); foreach ($bricks as $brick) { $params[$brick] = array('forceEditInView' => TRUE); } return array('allowed' => $bricks, 'params' => $params); }
public function calculateSlideColumnBreakpoints($columnType) { $columnType = (int) $columnType; $configNode = Config::getConfig()->slideColumns; $breakpoints = []; if (!empty($configNode)) { $configInfo = $configNode->toArray(); if (isset($configInfo['breakpoints']) && isset($configInfo['breakpoints'][$columnType])) { $breakpoints = $configInfo['breakpoints'][$columnType]; } } return $breakpoints; }