/**
  * Creates a new backend layout using the given record data.
  *
  * @param array $data
  * @return BackendLayout
  */
 protected function createBackendLayout(array $data)
 {
     $backendLayout = BackendLayout::create($data['uid'], $data['title'], $data['config']);
     $backendLayout->setIconPath($this->getIconPath($data['icon']));
     $backendLayout->setData($data);
     return $backendLayout;
 }
 /**
  * Create a backend layout with the given information
  *
  * @param $info
  *
  * @return mixed
  */
 protected function createBackendLayout($info)
 {
     $fileName = GeneralUtility::getFileAbsFileName($info['path']);
     $backendLayout = BackendLayout::create($this->getIdentifier($info), $info['label'], GeneralUtility::getUrl($fileName));
     if ($info['icon']) {
         $backendLayout->setIconPath(str_replace(PATH_site, '', $info['icon']));
     }
     return $backendLayout;
 }
Exemple #3
0
 /**
  * @param $identifier
  * @param $backendLayoutTS
  * @return BackendLayout
  */
 protected function createBackendLayout($identifier, $backendLayoutTS)
 {
     $backendLayoutObject = BackendLayout::create($identifier, $backendLayoutTS['name'], 'backend_layout {' . "\n" . $backendLayoutTS['backend_layout'] . "\n}");
     $icon = GeneralUtility::getFileAbsFileName($backendLayoutTS['icon']);
     if (is_file($icon)) {
         $icon = '../' . str_replace(PATH_site, '', $icon);
         $backendLayoutObject->setIconPath($icon);
     }
     return $backendLayoutObject;
 }
 /**
  * Creates a new backend layout using the given record data.
  *
  * @param  string        $id
  * @param  array         $data
  * @return BackendLayout
  */
 protected function createBackendLayout($id, $layout)
 {
     $layout['uid'] = $id;
     if (isset($layout['config.'])) {
         $layout['config'] = array('backend_layout.' => $layout['config.']);
         unset($layout['config.']);
         $layout['config'] = $this->typoscriptToString($layout['config']);
     }
     if (!isset($layout['title'])) {
         $layout['title'] = 'Untitled';
     }
     $layout['icon'] = $this->getIconPath($layout['icon']);
     $backendLayout = BackendLayout::create($layout['uid'], $layout['title'], $layout['config']);
     $backendLayout->setIconPath($this->getIconPath($layout['icon']));
     $backendLayout->setData($layout);
     return $backendLayout;
 }
Exemple #5
0
 /**
  * Add an optional icon to the BackendLayout
  *
  * @param array $fileInformation pathinfo() of the given file
  * @param BackendLayout $backendLayout
  * @return void
  */
 protected function addIcon($fileInformation, BackendLayout $backendLayout)
 {
     $imageExtensions = explode(',', self::FILE_TYPES_ICON);
     $filePath = $fileInformation['dirname'] . '/' . $fileInformation['filename'];
     foreach ($imageExtensions as $extension) {
         $icon = $filePath . '.' . $extension;
         // First check if icon is available in public folder
         $iconPublic = str_replace('/Private/', '/Public/', $icon);
         $icon = is_file($iconPublic) ? $iconPublic : $icon;
         if (is_file($icon)) {
             $icon = '../' . str_replace(PATH_site, '', $icon);
             $backendLayout->setIconPath($icon);
             break;
         }
     }
 }
 /**
  * Transforms this object into a BackendLayout object
  *
  * @return BackendLayout
  */
 public function toBackendLayout()
 {
     return BackendLayout::create($this->getIdentifier(), $this->getTitle(), $this->getContent());
 }
 /**
  * GetDefaultBackendLayout
  *
  * @return BackendLayout
  */
 private function getDefaultBackendLayout()
 {
     return BackendLayout::create('default', 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:pages.backend_layout.default', BackendLayoutView::getDefaultColumnLayout());
 }
 /**
  * Creates a new backend layout (object) using the given record data.
  *
  * @param array $data
  * @return BackendLayout
  */
 protected function createBackendLayout(array $data)
 {
     $configurationData = GeneralUtility::getUrl($data['configFilePath']);
     $configurationData = str_replace('###PACKAGE_KEY###', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['Staempfli/TemplateBootstrap']['PackageKey'], $configurationData);
     $backendLayout = BackendLayout::create($data['layoutKey'], $data['title'], $configurationData);
     $backendLayout->setIconPath($this->getIconPath($data['icon']));
     $backendLayout->setData($data);
     return $backendLayout;
 }
 /**
  * Registers icon for the backend layout
  *
  * @param array $fileInformation Information about the backend layout file
  * @param BackendLayout $backendLayout
  * @return void
  */
 protected function addIcon($fileInformation, BackendLayout $backendLayout)
 {
     $file = ExtensionManagementUtility::extPath('bdp_template', '/Resources/Public/Backend/Images/' . $fileInformation['filename'] . '.');
     $extensions = array('png', 'gif');
     foreach ($extensions as $extension) {
         if (is_file($file . $extension)) {
             $backendLayout->setIconPath(ExtensionManagementUtility::extRelPath('bdp_template') . '/Resources/Public/Backend/Images/' . $fileInformation['filename'] . '.' . $extension);
             break;
         }
     }
 }