コード例 #1
0
 /**
  * Check and create the TCA information
  * disable this for better performance
  */
 public static function checkAndCreateTcaInformation()
 {
     $register = SmartObjectRegister::getRegister();
     $baseTemplatePath = ExtensionManagementUtility::extPath('autoloader', 'Resources/Private/Templates/TcaFiles/');
     $defaultTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Default.tmpl');
     $overrideTemplate = GeneralUtility::getUrl($baseTemplatePath . 'Override.tmpl');
     $search = ['__modelName__', '__tableName__', '__extensionKey__'];
     foreach ($register as $model) {
         $extensionKey = ClassNamingUtility::getExtensionKeyByModel($model);
         $basePath = ExtensionManagementUtility::extPath($extensionKey) . 'Configuration/TCA/';
         $tableName = ModelUtility::getTableNameByModelReflectionAnnotation($model);
         if ($tableName !== '') {
             $tcaFileName = $basePath . 'Overrides/' . $tableName . '.php';
             $template = $overrideTemplate;
         } else {
             $tableName = ModelUtility::getTableNameByModelName($model);
             $tcaFileName = $basePath . $tableName . '.php';
             $template = $defaultTemplate;
         }
         if (!is_file($tcaFileName)) {
             $replace = [str_replace('\\', '\\\\', $model), $tableName, $extensionKey];
             $content = str_replace($search, $replace, $template);
             FileUtility::writeFileAndCreateFolder($tcaFileName, $content);
         }
     }
 }
コード例 #2
0
ファイル: ContentController.php プロジェクト: c2po/autoloader
 /**
  * Render the content Element via ExtBase
  */
 public function indexAction()
 {
     $extensionKey = $this->settings['extensionKey'];
     $vendorName = $this->settings['vendorName'];
     $name = $this->settings['contentElement'];
     $data = $this->configurationManager->getContentObject()->data;
     $targetObject = ClassNamingUtility::getFqnByPath($vendorName, $extensionKey, 'Domain/Model/Content/' . $name);
     $model = ModelUtility::getModel($targetObject, $data);
     $view = $this->createStandaloneView();
     $view->assignMultiple(['data' => $data, 'object' => $model, 'settings' => $this->settings]);
     return $view->render();
 }
コード例 #3
0
 /**
  * Render the content Element via ExtBase
  */
 public function indexAction()
 {
     $extensionKey = $this->settings['extensionKey'];
     $vendorName = $this->settings['vendorName'];
     $name = $this->settings['contentElement'];
     $data = $this->configurationManager->getContentObject()->data;
     $camelCaseExtKey = GeneralUtility::underscoredToUpperCamelCase($extensionKey);
     $targetObject = $vendorName . '\\' . $camelCaseExtKey . '\\Domain\\Model\\Content\\' . $name;
     $model = ModelUtility::getModel($targetObject, $data);
     $view = $this->createStandaloneView();
     $view->assignMultiple(['data' => $data, 'object' => $model, 'settings' => $this->settings]);
     return $view->render();
 }
コード例 #4
0
 /**
  * Render the Backend Preview Template and return the HTML.
  *
  * @param array $row
  *
  * @return string
  */
 public function getBackendPreview($row)
 {
     if (!$this->hasBackendPreview($row)) {
         return '';
     }
     $ctype = $row['CType'];
     /** @var array $config */
     $config = $GLOBALS['TYPO3_CONF_VARS']['AUTOLOADER']['ContentObject'][$ctype];
     $model = ModelUtility::getModel($config['modelClass'], $row, true);
     $view = ExtendedUtility::createExtensionStandaloneView($config['extensionKey'], $config['backendTemplatePath']);
     $view->assignMultiple(['data' => $row, 'object' => $model]);
     return $view->render();
 }
コード例 #5
0
 /**
  * Find table and model information for the given extension key
  *
  * @param string $extensionKey
  *
  * @return array
  */
 protected function findTableAndModelInformationForExtension($extensionKey)
 {
     $information = [];
     $register = SmartObjectRegister::getRegister();
     foreach ($register as $class) {
         $parts = ClassNamingUtility::explodeObjectModelName($class);
         if (GeneralUtility::camelCaseToLowerCaseUnderscored($parts['extensionName']) === $extensionKey) {
             if (ModelUtility::getTableNameByModelReflectionAnnotation($class) === '') {
                 $information[] = ['table' => ModelUtility::getTableNameByModelName($class), 'class' => $class];
             }
         }
     }
     return $information;
 }
コード例 #6
0
 /**
  * Find table and model information for the given extension key
  *
  * @param string $extensionKey
  *
  * @return array
  */
 protected function findTableAndModelInformationForExtension($extensionKey)
 {
     $information = [];
     $register = SmartObjectRegister::getRegister();
     foreach ($register as $class) {
         $parts = ClassNamingUtility::explodeObjectModelName($class);
         if (GeneralUtility::camelCaseToLowerCaseUnderscored($parts['extensionName']) === $extensionKey) {
             if (ModelUtility::getTableNameByModelReflectionAnnotation($class) === '') {
                 $modelInformation = SmartObjectInformationService::getInstance()->getCustomModelFieldTca($class);
                 $information[] = ['table' => ModelUtility::getTableNameByModelName($class), 'properties' => array_keys($modelInformation)];
             }
         }
     }
     return $information;
 }
コード例 #7
0
 /**
  * Generate complete SQL Query
  *
  * @param string $modelClassName
  * @param string $tableName
  * @param array $custom
  *
  * @return string
  */
 protected function generateCompleteSqlQuery($modelClassName, $tableName, array $custom)
 {
     $fields = [];
     $fields[] = 'uid int(11) NOT NULL auto_increment';
     $fields[] = 'pid int(11) DEFAULT \'0\' NOT NULL';
     $fields[] = 'tstamp int(11) unsigned DEFAULT \'0\' NOT NULL';
     $fields[] = 'crdate int(11) unsigned DEFAULT \'0\' NOT NULL';
     $fields[] = 'cruser_id int(11) unsigned DEFAULT \'0\' NOT NULL';
     $fields[] = 'deleted tinyint(4) unsigned DEFAULT \'0\' NOT NULL';
     $fields[] = 'sorting int(11) DEFAULT \'0\' NOT NULL';
     foreach ($custom as $field) {
         $fields[] = $field;
     }
     $excludes = ModelUtility::getSmartExcludesByModelName($modelClassName);
     $dataSet = $this->getDataSet();
     $dataImplementations = $dataSet->getAllAndExcludeList($excludes);
     // add data set fields
     $fields = array_merge($fields, $dataSet->getDatabaseSqlInformation($dataImplementations, $tableName));
     // default keys
     $fields[] = 'PRIMARY KEY (uid)';
     $fields[] = 'KEY parent (pid)';
     // add data set keys
     $fields = array_merge($fields, $dataSet->getDatabaseSqlKeyInformation($dataImplementations, $tableName));
     return $this->generateSqlQuery($tableName, $fields);
 }
コード例 #8
0
<?php

/**
 * TCA Structure for Events
 */
$base = \HDNET\Autoloader\Utility\ModelUtility::getTcaInformation('HDNET\\Calendarize\\Domain\\Model\\Event');
$custom = array('ctrl' => array('hideTable' => (bool) \HDNET\Calendarize\Utility\ConfigurationUtility::get('disableDefaultEvent'), 'searchFields' => 'uid,title,description', 'thumbnail' => 'images'), 'columns' => array('title' => array('type' => 'text', 'eval' => 'required')));
return \HDNET\Autoloader\Utility\ArrayUtility::mergeRecursiveDistinct($base, $custom);
コード例 #9
0
<?php

$base = \HDNET\Autoloader\Utility\ModelUtility::getTcaInformation('HDNET\\Faq\\Domain\\Model\\Question');
$custom = array('ctrl' => array('sortby' => null), 'columns' => array('title' => array('config' => array('eval' => 'trim,required')), 'answer' => array('config' => array('type' => 'text'), 'defaultExtras' => 'richtext:rte_transform[flag=rte_enabled|mode=ts_css]'), 'categories' => array('config' => array('type' => 'select', 'renderType' => 'selectTree', 'foreign_table' => 'tx_faq_domain_model_questioncategory', 'maxitems' => '999', 'minitems' => '1', 'MM' => 'tx_faq_mm_question_questioncategory', 'renderMode' => 'tree', 'treeConfig' => array('parentField' => 'parent')))));
return \HDNET\Autoloader\Utility\ArrayUtility::mergeRecursiveDistinct($base, $custom);
コード例 #10
0
 /**
  * Generate the TypoScript setup for the smart objects defined
  * within the extension
  *
  * @param string $extensionKey
  *
  * @return array
  */
 private function generateTypoScriptSetup($extensionKey)
 {
     $setup = [];
     foreach ($this->getSmartObjectsForExtensionKey($extensionKey) as $className) {
         $table = ModelUtility::getTableNameByModelReflectionAnnotation($className);
         $recordType = (string) ReflectionUtility::getFirstTagValue($className, 'recordType');
         $parentClass = (string) ReflectionUtility::getFirstTagValue($className, 'parentClass');
         if ($table !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $className . '.mapping.tableName = ' . $table;
         }
         if ($recordType !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $className . '.mapping.recordType = ' . $recordType;
         }
         if ($parentClass !== '') {
             $setup[] = 'config.tx_extbase.persistence.classes.' . $parentClass . '.subclasses.' . $className . ' = ' . $className;
         }
     }
     return $setup;
 }
コード例 #11
0
<?php

/**
 * Base TCA generation for the table tt_content
 */
$GLOBALS['TCA']['tt_content'] = \HDNET\Autoloader\Utility\ModelUtility::getTcaOverrideInformation('focuspoint', 'tt_content');
$custom = array('columns' => array('image_ratio' => array('config' => array('type' => 'select', 'items' => array(array('', ''), array('1:1 / Square', '1:1'), array('Images (landscape)', '--div--'), array('10×7', '10:7'), array('13×9', '13:9'), array('Postcard', '14.8:10.5'), array('13×10', '13:10'), array('15×10', '15:10'), array('18×13', '18:13'), array('19×13', '19:13'), array('24×18', '24:18'), array('Images (Portrait)', '--div--'), array('7×10', '7:10'), array('9×13', '9:13'), array('Postcard', '10.5:14.8'), array('10×13', '10:13'), array('10×15', '10:15'), array('13×18', '13:18'), array('13×19', '13:19'), array('18×24', '18:24'), array('Movie', '--div--'), array('4:3 / original 35 mm silent movie', '4:3'), array('15:10 / 35 mm movie', '15:10'), array('16:9 / Widescreen Default (HD)', '16:9'), array('16:10 / Widescreen', '16:10'), array('11:5, 22:10 / 70 mm standard', '11:5'), array('64:27 / 4^3:3^3 television', '64:27'), array('8:3, 24:9 / Full frame Super 16 mm', '8:3'))))), 'palettes' => array('image_settings' => array('showitem' => str_replace('imageborder;', 'image_ratio,imageborder;', $GLOBALS['TCA']['tt_content']['palettes']['image_settings']['showitem']))));
$GLOBALS['TCA']['tt_content'] = \HDNET\Autoloader\Utility\ArrayUtility::mergeRecursiveDistinct($GLOBALS['TCA']['tt_content'], $custom);
コード例 #12
0
<?php

use HDNET\Autoloader\Utility\ArrayUtility;
use HDNET\Autoloader\Utility\ModelUtility;
use HDNET\Faq\Domain\Model\Questioncategory;
$base = ModelUtility::getTcaInformation(Questioncategory::class);
$custom = ['columns' => ['parent' => ['config' => ['type' => 'select', 'renderType' => 'selectTree', 'foreign_table' => 'tx_faq_domain_model_questioncategory', 'maxitems' => '1', 'minitems' => '0', 'renderMode' => 'tree', 'treeConfig' => ['parentField' => 'parent']]]]];
return ArrayUtility::mergeRecursiveDistinct($base, $custom);
コード例 #13
0
<?php

/**
 * Base TCA generation for the table sys_file_reference
 */
use HDNET\Autoloader\Utility\ArrayUtility;
use HDNET\Autoloader\Utility\ModelUtility;
use HDNET\Focuspoint\Utility\TcaUtility;
$GLOBALS['TCA']['sys_file_reference'] = ModelUtility::getTcaOverrideInformation('focuspoint', 'sys_file_reference');
$custom = ['columns' => ['focus_point_y' => TcaUtility::getBaseConfiguration(), 'focus_point_x' => TcaUtility::getBaseConfiguration()]];
$GLOBALS['TCA']['sys_file_reference'] = ArrayUtility::mergeRecursiveDistinct($GLOBALS['TCA']['sys_file_reference'], $custom);
コード例 #14
0
ファイル: sys_file_metadata.php プロジェクト: mcmz/focuspoint
<?php

/**
 * Base TCA generation for the table sys_file_metadata
 */
use HDNET\Autoloader\Utility\ArrayUtility;
use HDNET\Autoloader\Utility\ModelUtility;
use HDNET\Focuspoint\Utility\TcaUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
$GLOBALS['TCA']['sys_file_metadata'] = ModelUtility::getTcaOverrideInformation('focuspoint', 'sys_file_metadata');
$custom = ['columns' => ['focus_point_y' => TcaUtility::getBaseConfiguration(), 'focus_point_x' => TcaUtility::getBaseConfiguration()]];
$GLOBALS['TCA']['sys_file_metadata'] = ArrayUtility::mergeRecursiveDistinct($GLOBALS['TCA']['sys_file_metadata'], $custom);
ExtensionManagementUtility::addToAllTCAtypes('sys_file_metadata', 'focus_point_y,focus_point_x');
<?php

/**
 * TCA Structure for ConfigurationGroups
 */
$base = \HDNET\Autoloader\Utility\ModelUtility::getTcaInformation('HDNET\\Calendarize\\Domain\\Model\\ConfigurationGroup');
$custom = array('ctrl' => array('searchFields' => 'uid,title'), 'columns' => array('configurations' => array('config' => array('type' => 'inline', 'foreign_table' => 'tx_calendarize_domain_model_configuration', 'minitems' => 1))));
return \HDNET\Autoloader\Utility\ArrayUtility::mergeRecursiveDistinct($base, $custom);
コード例 #16
0
<?php

/**
 * Base TCA generation for the model HDNET\\Focuspoint\\Domain\\Model\\FileStandalone
 */
use HDNET\Autoloader\Utility\ArrayUtility;
use HDNET\Autoloader\Utility\ModelUtility;
use HDNET\Focuspoint\Utility\TcaUtility;
$base = ModelUtility::getTcaInformation('HDNET\\Focuspoint\\Domain\\Model\\FileStandalone');
$custom = ['ctrl' => ['hideTable' => true], 'columns' => ['focus_point_y' => TcaUtility::getBaseConfiguration(), 'focus_point_x' => TcaUtility::getBaseConfiguration()]];
return ArrayUtility::mergeRecursiveDistinct($base, $custom);
コード例 #17
0
<?php

/**
 * Base TCA generation for the table tx_faq_mm_question_questioncategory
 */
$GLOBALS['TCA']['tx_faq_mm_question_questioncategory'] = \HDNET\Autoloader\Utility\ModelUtility::getTcaOverrideInformation('faq', 'tx_faq_mm_question_questioncategory');
$custom = array('ctrl' => array('hideTable' => true));
$GLOBALS['TCA']['tx_faq_mm_question_questioncategory'] = \HDNET\Autoloader\Utility\ArrayUtility::mergeRecursiveDistinct($GLOBALS['TCA']['tx_faq_mm_question_questioncategory'], $custom);