Exemple #1
0
 /**
  * Get all the complex data for the loader.
  * This return value will be cached and stored in the database
  * There is no file monitoring for this cache
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $grids = [];
     if (!ExtensionManagementUtility::isLoaded('gridelements')) {
         return $grids;
     }
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/Grids/';
     $files = FileUtility::getBaseFilesWithExtensionInDir($commandPath, 'ts,txt');
     foreach ($files as $file) {
         $pathInfo = PathUtility::pathinfo($file);
         $iconPath = 'EXT:' . $loader->getExtensionKey() . '/Resources/Public/Icons/Grids/' . $pathInfo['filename'] . '.';
         $extension = IconUtility::getIconFileExtension(GeneralUtility::getFileAbsFileName($iconPath));
         $translationKey = 'grid.' . $pathInfo['filename'];
         if ($type === LoaderInterface::EXT_TABLES) {
             TranslateUtility::assureLabel($translationKey, $loader->getExtensionKey(), $pathInfo['filename']);
         }
         $path = 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Grids/' . $file;
         $icon = $extension ? $iconPath . $extension : false;
         $label = TranslateUtility::getLllString($translationKey, $loader->getExtensionKey());
         $content = GeneralUtility::getUrl(GeneralUtility::getFileAbsFileName($path));
         $flexForm = 'EXT:' . $loader->getExtensionKey() . '/Configuration/FlexForms/Grids/' . $pathInfo['filename'] . '.xml';
         $flexFormFile = GeneralUtility::getFileAbsFileName($flexForm);
         $flexFormContent = is_file($flexFormFile) ? GeneralUtility::getUrl($flexFormFile) : false;
         $grids[] = $this->getPageTsConfig($pathInfo['filename'], $label, $content, $icon, $flexFormContent);
     }
     return $grids;
 }
Exemple #2
0
 /**
  * Get all the complex data and information for the loader.
  * This return value will be cached and stored in the core_cache of TYPO3.
  * There is no file monitoring for this cache.
  *
  * @param Loader $loader
  * @param int    $type
  *
  * @return array
  */
 public function prepareLoader(Loader $loader, $type)
 {
     $backendLayouts = array();
     $commandPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Resources/Private/BackendLayouts/';
     $backendLayoutFiles = FileUtility::getBaseFilesWithExtensionInDir($commandPath, 'ts,txt');
     foreach ($backendLayoutFiles as $file) {
         $pathInfo = PathUtility::pathinfo($file);
         $iconPath = 'EXT:' . $loader->getExtensionKey() . '/Resources/Public/Icons/BackendLayouts/' . $pathInfo['filename'] . '.';
         $extension = IconUtility::getIconFileExtension(GeneralUtility::getFileAbsFileName($iconPath));
         $translationKey = 'backendLayout.' . $pathInfo['basename'];
         if ($type === LoaderInterface::EXT_TABLES) {
             TranslateUtility::assureLabel($translationKey, $loader->getExtensionKey(), $pathInfo['filename']);
         }
         $backendLayouts[] = array('path' => 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/BackendLayouts/' . $file, 'filename' => $pathInfo['filename'], 'icon' => $extension ? $iconPath . $extension : FALSE, 'label' => TranslateUtility::getLllString($translationKey, $loader->getExtensionKey()), 'extension' => $loader->getExtensionKey());
     }
     return $backendLayouts;
 }
 /**
  * Get the LLL string
  *
  * @param string $key
  *
  * @return string
  */
 public static function getLll($key)
 {
     return \HDNET\Autoloader\Utility\TranslateUtility::getLllString($key, 'calendarize', 'locallang.xlf');
 }
Exemple #4
0
    /**
     * Run the loading process for the ext_tables.php file
     *
     * @param Loader $loader
     * @param array  $loaderInformation
     *
     * @return NULL
     */
    public function loadExtensionTables(Loader $loader, array $loaderInformation)
    {
        if (!$loaderInformation) {
            return null;
        }
        $createWizardHeader = [];
        $predefinedWizards = ['common', 'special', 'forms', 'plugins'];
        // Add the divider
        $GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'][] = [TranslateUtility::getLllString('tt_content.' . $loader->getExtensionKey() . '.header', $loader->getExtensionKey()), '--div--'];
        foreach ($loaderInformation as $e => $config) {
            SmartObjectRegister::register($config['modelClass']);
            $typeKey = $loader->getExtensionKey() . '_' . $e;
            ExtensionManagementUtility::addPlugin([TranslateUtility::getLllOrHelpMessage('content.element.' . $e, $loader->getExtensionKey()), $typeKey, $config['iconExt']], 'CType');
            if (!isset($GLOBALS['TCA']['tt_content']['types'][$typeKey]['showitem'])) {
                $baseTcaConfiguration = $this->wrapDefaultTcaConfiguration($config['fieldConfiguration'], (bool) $config['noHeader']);
                if (ExtensionManagementUtility::isLoaded('gridelements')) {
                    $baseTcaConfiguration .= ',tx_gridelements_container,tx_gridelements_columns';
                }
                $GLOBALS['TCA']['tt_content']['types'][$typeKey]['showitem'] = $baseTcaConfiguration;
            }
            // RTE
            if (isset($config['richTextFields']) && is_array($config['richTextFields']) && $config['richTextFields']) {
                foreach ($config['richTextFields'] as $field) {
                    $GLOBALS['TCA']['tt_content']['types'][$typeKey]['columnsOverrides'][$field] = ['config' => ['type' => 'text'], 'defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css]'];
                }
            }
            IconUtility::addTcaTypeIcon('tt_content', $typeKey, $config['icon']);
            $tabName = $config['tabInformation'] ? $config['tabInformation'] : $loader->getExtensionKey();
            if (!in_array($tabName, $predefinedWizards) && !in_array($tabName, $createWizardHeader)) {
                $createWizardHeader[] = $tabName;
            }
            ExtensionManagementUtility::addPageTSConfig('
mod.wizards.newContentElement.wizardItems.' . $tabName . '.elements.' . $typeKey . ' {
    icon = ' . $config['icon'] . '
    title = ' . TranslateUtility::getLllOrHelpMessage('wizard.' . $e, $loader->getExtensionKey()) . '
    description = ' . TranslateUtility::getLllOrHelpMessage('wizard.' . $e . '.description', $loader->getExtensionKey()) . '
    tt_content_defValues {
        CType = ' . $typeKey . '
    }
}
mod.wizards.newContentElement.wizardItems.' . $tabName . '.show := addToList(' . $typeKey . ')');
            $cObjectConfiguration = ['extensionKey' => $loader->getExtensionKey(), 'backendTemplatePath' => 'EXT:' . $loader->getExtensionKey() . '/Resources/Private/Templates/Content/' . $config['model'] . 'Backend.html', 'modelClass' => $config['modelClass']];
            $GLOBALS['TYPO3_CONF_VARS']['AUTOLOADER']['ContentObject'][$loader->getExtensionKey() . '_' . GeneralUtility::camelCaseToLowerCaseUnderscored($config['model'])] = $cObjectConfiguration;
        }
        if ($createWizardHeader) {
            foreach ($createWizardHeader as $element) {
                ExtensionManagementUtility::addPageTSConfig('
mod.wizards.newContentElement.wizardItems.' . $element . ' {
    show = *
    header = ' . TranslateUtility::getLllOrHelpMessage('wizard.' . $element . '.header', $loader->getExtensionKey()) . '
}');
            }
        }
        return null;
    }