system/modules/pct_customelements/config/config.php line 72

Open in your IDE?
  1. <?php
  2. /**
  3.  * Contao Open Source CMS
  4.  * 
  5.  * Copyright (C) 2005-2013 Leo Feyer
  6.  * 
  7.  * @copyright    Tim Gatzky 2013, Premium Contao Webworks, Premium Contao Themes
  8.  * @author        Tim Gatzky <info@tim-gatzky.de>
  9.  * @package        pct_customelements
  10.  * @link        http://contao.org
  11.  */
  12. /**
  13.  * Constants
  14.  */
  15. define('PCT_CUSTOMELEMENTS_PATH''system/modules/pct_customelements');
  16. define('PCT_CUSTOMELEMENTS_VERSION''4.5.11');
  17. define('PCT_CUSTOMELEMENTS_FONTAWESOME_VERSION','4.7.0');
  18. $blnInstallTool false;
  19. if(strlen(strpos(\Contao\Environment::get('scriptName'), '/contao/install.php')) > || strlen(strpos(\Contao\Environment::get('requestUri'), '/contao/install')) > 0)
  20. {
  21.     $blnInstallTool true;
  22. }
  23. /**
  24.  * Globals
  25.  */
  26. $GLOBALS['PCT_CUSTOMELEMENTS']['allowedTables']                    = array('tl_content','tl_module','tl_page','tl_article','tl_news_archive','tl_news','tl_calendar','tl_calendar_events','tl_revolutionslider_slides','tl_revolutionslider'); // list of tables that are allowed to include custom elements
  27. $GLOBALS['PCT_CUSTOMELEMENTS']['restrictedTables']                = array('tl_files','tl_templates','tl_theme','tl_style_sheet','tl_layout','tl_image_size');
  28. $GLOBALS['PCT_CUSTOMELEMENTS']['showVaultButton']                = false;
  29. $GLOBALS['PCT_CUSTOMELEMENTS']['defaultWildcardImageSize']         = array('','50','proportional');
  30. $GLOBALS['PCT_CUSTOMELEMENTS_REGISTRY']                            = array();
  31. if(!isset($GLOBALS['PCT_CUSTOMELEMENTS']['cache']))
  32. {
  33.     $GLOBALS['PCT_CUSTOMELEMENTS']['cache'] = array();
  34. }                            
  35. $GLOBALS['PCT_CUSTOMELEMENTS']['debug']                            = false;
  36. $GLOBALS['PCT_CUSTOMELEMENTS']['saveValuesInWizard']            = true;    // attribute values will be saved in the wizard data array
  37. $GLOBALS['PCT_CUSTOMELEMENTS']['cacheLimit']['wizard']            = 0// limit the number of wizard datas cached automatically 
  38. $GLOBALS['PCT_CUSTOMELEMENTS']['cacheWizardsInBackend']            = true// if set to true, wizard data will be cached in the backend. (frontend is enabled by default)
  39. $GLOBALS['PCT_CUSTOMELEMENTS']['fieldnamesSharedWithContao']     = array('headline','singleSRC','multiSRC','cssID','guests','invisible'); // if your CC has fields that exist in the tl_content table from contao, add the fieldname to this list to avoid that contao processes the field when rendering the attribute e.g. having a field 'headline' in your table and then rendering a files attribute with downlods. Contao renders the headline value as well because it finds the headline field in the active record.
  40. $GLOBALS['PCT_CUSTOMELEMENTS']['exportCustomCatalogTables']        = false// if set to true, the export will include the tables create with customcatalog
  41. $GLOBALS['PCT_CUSTOMELEMENTS']['path_to_export']                = 'templates';
  42. $GLOBALS['PCT_CUSTOMELEMENTS']['path_to_import']                = 'templates';
  43. $bundles array_keys(\Contao\System::getContainer()->getParameter('kernel.bundles'));
  44. if( in_array('pct_theme_templates'$bundles) )
  45. {
  46.     $GLOBALS['PCT_CUSTOMELEMENTS']['path_to_import'] = 'system/modules/pct_theme_templates/pct_templates/ce_imports';
  47. }
  48. $GLOBALS['PCT_CUSTOMELEMENTS']['ignoreOptionFields']            = array('list','table','checkboxMenu','select'); // add attributes that uses the options column for simpel optional values not for generic option fields
  49. // content element set export
  50. $GLOBALS['PCT_CUSTOMELEMENTS']['multiSRC_fields']                = array('multiSRC');
  51. $GLOBALS['PCT_CUSTOMELEMENTS']['singleJumpTo_fields']             = array('jumpTo','customcatalog_jumpTo','reg_jumpTo'); // relink single pages 
  52. $GLOBALS['PCT_CUSTOMELEMENTS']['contentElementSetTemplatePrefix'] = 'set_';
  53. $GLOBALS['PCT_CUSTOMELEMENTS']['sourceField'] = array
  54. (
  55.     'tl_content' => 'pct_customelement',
  56.     'tl_module' => 'pct_customelement',
  57. );
  58. /**
  59.  * Back end modules
  60.  */
  61. array_insert($GLOBALS['BE_MOD']['content'], count($GLOBALS['BE_MOD']['content']), array
  62. (
  63.     'pct_customelements' => array
  64.     (
  65.         'tables'         => array('tl_pct_customelement','tl_pct_customelement_group','tl_pct_customelement_attribute','tl_pct_customelement_vault','tl_pct_customelement_plugin'),
  66.         'icon'           => PCT_CUSTOMELEMENTS_PATH.'/assets/img/icon.gif',
  67.         'import'        => array('PCT\CustomElements\Backend\Import''createInterface'),
  68.         'export'        => array('PCT\CustomElements\Plugins\Export\Export','createInterface'),
  69.     )
  70. ));
  71. /**
  72.  * Rgister backend keys
  73.  */
  74. $GLOBALS['BE_MOD']['content']['article']['contentelementset'] = array('PCT\CustomElements\Backend\PageContentElementSet','run'); 
  75. $GLOBALS['BE_MOD']['content']['article']['contentelementset_export'] = array('PCT\CustomElements\Backend\PageContentElementSetExport','run'); 
  76. /**
  77.  * Content elements
  78.  */
  79. $GLOBALS['TL_CTE']['pct_customelements_node'] = array();
  80. $GLOBALS['TL_CTE']['pct_contentelementsets_node']['pct_contentelementset_start'] = '\Contao\PCT\ContentElementSet';
  81. $GLOBALS['TL_CTE']['pct_contentelementsets_node']['pct_contentelementset_stop'] = '\Contao\PCT\ContentElementSet';
  82. /**
  83.  * Front end modules
  84.  */
  85. $GLOBALS['FE_MOD']['pct_customelements_node'] = array();
  86. /**
  87.  * Back end form fields
  88.  */
  89. $GLOBALS['BE_FFL']['pct_customelement']                    = 'PCT\CustomElements\Widgets\WidgetCustomElement';
  90. /**
  91.  * Register the model classes
  92.  */
  93. $GLOBALS['TL_MODELS']['tl_pct_customelement_attribute'] = 'PCT\CustomElements\Models\AttributeModel';
  94. $GLOBALS['TL_MODELS']['tl_pct_customelement']             = 'PCT\CustomElements\Models\CustomElementModel';
  95. $GLOBALS['TL_MODELS']['tl_pct_customelement_group']     = 'PCT\CustomElements\Models\GroupModel';
  96. $GLOBALS['TL_MODELS']['tl_pct_customelement_plugin']     = 'PCT\CustomElements\Models\PluginModel';
  97. $GLOBALS['TL_MODELS']['tl_pct_customelement_vault']     = 'PCT\CustomElements\Models\VaultModel';
  98. /**
  99.  * Default rendering classes
  100.  */
  101. $GLOBALS['PCT_CUSTOMELEMENTS']['TL_CTE']                 = 'PCT\CustomElements\Frontend\ContentCustomElement';
  102. $GLOBALS['PCT_CUSTOMELEMENTS']['TL_FMD']                 = 'PCT\CustomElements\Frontend\ModuleCustomElement';
  103. $GLOBALS['PCT_CUSTOMELEMENTS']['palette']                = '{type_legend},type;###CUSTOMELEMENT_WIDGET###';
  104. /**
  105.  * Wrappers
  106.  */
  107. #$GLOBALS['TL_WRAPPERS']['start'][] = 'pct_contentelementset_start';
  108. #$GLOBALS['TL_WRAPPERS']['stop'][] = 'pct_contentelementset_stop';
  109. /**
  110.  * Maintenance
  111.  */
  112. $GLOBALS['TL_MAINTENANCE'][] = 'PCT\CustomElements\Core\Maintenance\Jobs';
  113. // Jobs
  114. $GLOBALS['PCT_CUSTOMELEMENTS']['MAINTENANCE'] = array
  115. (
  116.     'resolveVault'    => array
  117.     (
  118.         'callback'    => array('PCT\CustomElements\Core\Maintenance\VaultUpdater','resolve'),
  119.         'key'        => 'resolveVault',
  120.     ),
  121. );
  122. /**
  123.  * Add permissions
  124.  */
  125. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelements';
  126. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelementsp';
  127. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelement_groups';
  128. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelement_groupsp';
  129. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelement_attributes';
  130. $GLOBALS['TL_PERMISSIONS'][] = 'pct_customelement_attributesp';
  131. $GLOBALS['TL_PERMISSIONS'][] = 'protect_pct_customelement_groups';
  132. $GLOBALS['TL_PERMISSIONS'][] = 'protect_pct_customelement_attributes';
  133. // register attributes
  134. array_insert($GLOBALS['PCT_CUSTOMELEMENTS']['ATTRIBUTES'],0,array
  135. (
  136.     'text'    => array
  137.     (
  138.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['text'],
  139.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Text',
  140.         'class'        => 'PCT\CustomElements\Attributes\Text',
  141.         'icon'        => 'fa fa-file-text-o'
  142.     ),
  143.     'headline'    => array
  144.     (
  145.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['headline'],
  146.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Headline',
  147.         'class'        => 'PCT\CustomElements\Attributes\Headline',
  148.         'icon'        => 'fa fa-header'
  149.     ),
  150.     'url'    => array
  151.     (
  152.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['url'],
  153.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Url',
  154.         'class'        => 'PCT\CustomElements\Attributes\Url',
  155.         'icon'        => 'fa fa-globe'
  156.     ),
  157.     'files'    => array
  158.     (
  159.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['files'],
  160.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Files',
  161.         'class'        => 'PCT\CustomElements\Attributes\Files',
  162.         'icon'        => 'fa fa-file-o'
  163.     ),
  164.     'textarea'    => array
  165.     (
  166.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['textarea'],
  167.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Textarea',
  168.         'class'        => 'PCT\CustomElements\Attributes\Textarea',
  169.         'icon'        => 'fa fa-file-text'
  170.     ),
  171.     'select'    => array
  172.     (
  173.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['select'],
  174.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Select',
  175.         'class'        => 'PCT\CustomElements\Attributes\Select',
  176.         'icon'        => 'fa fa-sort'
  177.     ),
  178.     'checkboxMenu'    => array
  179.     (
  180.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['checkboxMenu'],
  181.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/CheckboxMenu',
  182.         'class'        => 'PCT\CustomElements\Attributes\CheckboxMenu',
  183.         'icon'        => 'fa fa-check-square-o'
  184.     ),
  185.     'checkbox'    => array
  186.     (
  187.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['checkbox'],
  188.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Checkbox',
  189.         'class'        => 'PCT\CustomElements\Attributes\Checkbox',
  190.         'icon'        => 'fa fa-check-square-o'
  191.     ),
  192.     'image'    => array
  193.     (
  194.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['image'],
  195.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Image',
  196.         'class'        => 'PCT\CustomElements\Attributes\Image',
  197.         'icon'        => 'fa fa-file-image-o'
  198.     ),
  199.     'backend_explanation' => array
  200.     (
  201.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['backend_explanation'],
  202.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/BackendExplanation',
  203.         'class'        => 'PCT\CustomElements\Attributes\BackendExplanation',
  204.         'icon'        => 'fa fa-info-circle'
  205.     ),
  206.     'include' => array
  207.     (
  208.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['include'],
  209.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/IncludeElement',
  210.         'class'        => 'PCT\CustomElements\Attributes\IncludeElement',
  211.         'icon'        => 'fa fa-code-fork'
  212.     ),
  213.     'timestamp' => array
  214.     (
  215.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['timestamp'],
  216.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Timestamp',
  217.         'class'        => 'PCT\CustomElements\Attributes\Timestamp',
  218.         'icon'        => 'fa fa-calendar'
  219.     ),
  220.     'table' => array
  221.     (
  222.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['table'],
  223.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Table',
  224.         'class'        => 'PCT\CustomElements\Attributes\Table',
  225.         'icon'        => 'fa fa-table'
  226.     ),
  227.     'list' => array
  228.     (
  229.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['list'],
  230.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/ListElement',
  231.         'class'        => 'PCT\CustomElements\Attributes\ListElement',
  232.         'icon'        => 'fa fa-list'
  233.     ),
  234.     'number' => array
  235.     (
  236.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['number'],
  237.         'path'        => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Number',
  238.         'class'        => 'PCT\CustomElements\Attributes\Number',
  239.         'icon'        => 'fa fa-calculator'
  240.     ),
  241.     'optionWizard' => array
  242.     (
  243.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['optionWizard'],
  244.         'path'        => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/OptionWizard',
  245.         'class'        => 'PCT\CustomElements\Attributes\OptionWizard',
  246.         'icon'        => 'fa fa-reorder'
  247.     ),
  248.     'colorpicker'    => array
  249.     (
  250.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['colorpicker'],
  251.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Colorpicker',
  252.         'class'        => 'PCT\CustomElements\Attributes\Colorpicker',
  253.         'icon'        => 'fa fa-file-text-o'
  254.     ),
  255.     'gallery'     => array
  256.     (
  257.         'label'        => &$GLOBALS['TL_LANG']['PCT_CUSTOMELEMENTS']['ATTRIBUTES']['gallery'],
  258.         'path'         => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Attributes/Gallery',
  259.         'class'        => 'PCT\CustomElements\Attributes\Gallery',
  260.         'icon'        => 'fa fa-image',
  261.         'backendWildcardSize' => array('50','50','center_center'),
  262.     )
  263. ));
  264. // register plugins
  265. if(!isset($GLOBALS['PCT_CUSTOMELEMENTS']['PLUGINS']))
  266. {
  267.     $GLOBALS['PCT_CUSTOMELEMENTS']['PLUGINS'] = array();
  268. }
  269. // export plugin
  270. $GLOBALS['PCT_CUSTOMELEMENTS']['PLUGINS']['export'] = array
  271. (
  272.     'path' => PCT_CUSTOMELEMENTS_PATH.'/PCT/CustomElements/Plugins/Export',
  273. );
  274. /**
  275.  * Hooks
  276.  */
  277. // load attributes
  278. $GLOBALS['TL_HOOKS']['initializeSystem'][]                     = array('PCT\CustomElements\Loader\AttributeLoader','loadOnSystem');
  279. // load plugins
  280. $GLOBALS['TL_HOOKS']['initializeSystem'][]                     = array('PCT\CustomElements\Loader\PluginsLoader','loadOnSystem');
  281. if($blnInstallTool === false)
  282. {
  283.     array_insert($GLOBALS['TL_HOOKS']['loadDataContainer'],0,array(array('PCT\CustomElements\Helper\DcaHelper''initializeBackend')) );
  284.     
  285.     $GLOBALS['TL_HOOKS']['initializeSystem'][]                 = array('PCT\CustomElements\Core\SystemIntegration''initSystem');
  286.     $GLOBALS['TL_HOOKS']['initializeSystem'][]                 = array('PCT\CustomElements\Core\SystemIntegration''showVaultMigrationAlert');
  287.     $GLOBALS['TL_HOOKS']['parseTemplate'][]                 = array('PCT\CustomElements\Backend\BackendIntegration''injectJavascriptInBackendPage');
  288.     $GLOBALS['TL_HOOKS']['parseTemplate'][]                 = array('PCT\CustomElements\Backend\BackendIntegration''injectVersionnumberInBackendPage');
  289.     if( TL_MODE == 'BE' )
  290.     {
  291.         $GLOBALS['TL_HOOKS']['initializeSystem'][]                 = array('PCT\CustomElements\Backend\BackendIntegration','loadAssets');
  292.     }
  293. }
  294. // Content element set export has been called
  295. if(TL_MODE == 'BE' && (boolean)\Contao\Config::get('contentelementset_export') === true && \Contao\Input::post('contentelementset_export') != '')
  296. {
  297.     $GLOBALS['TL_HOOKS']['loadDataContainer'][]                 = array('PCT\CustomElements\Backend\TableContent','exportElements');
  298. }
  299. $GLOBALS['TL_HOOKS']['loadDataContainer'][]                 = array('PCT\CustomElements\Loader\PluginsLoader','loadOnDataContainer');
  300. $GLOBALS['TL_HOOKS']['replaceInsertTags'][]                 = array('PCT\CustomElements\Core\InsertTags''replaceTags');
  301. $GLOBALS['TL_HOOKS']['executePostActions'][]                 = array('PCT\CustomElements\Helper\DcaHelper''executePostActions');
  302. $GLOBALS['TL_HOOKS']['executePreActions'][]                 = array('PCT\CustomElements\Helper\DcaHelper''executePreActions');
  303. $GLOBALS['TL_HOOKS']['reviseTable'][]                         = array('PCT\CustomElements\Core\Vault''purgeDuplicates');
  304. #$GLOBALS['TL_HOOKS']['reviseTable'][]                         = array('PCT\CustomElements\Core\Vault', 'purgeVault');
  305. #$GLOBALS['TL_CRON']['daily'][]                                 = array('PCT\CustomElements\Core\Vault', 'purgeVaultCronJob');
  306. $GLOBALS['CUSTOMELEMENTS_HOOKS']['observeClipboard'][]         = array('PCT\CustomElements\Core\Callbacks','observeClipboard');
  307. $GLOBALS['CUSTOMELEMENTS_HOOKS']['createCopyInVault'][]     = array('PCT\CustomElements\Core\Callbacks','createCopyInVault');
  308. $GLOBALS['CUSTOMELEMENTS_HOOKS']['removeFromVault'][]         = array('PCT\CustomElements\Core\Callbacks','removeFromVault');
  309. $GLOBALS['CUSTOMELEMENTS_HOOKS']['prepareForDca'][]            = array('PCT\CustomElements\Helper\DcaHelper''storeAttributeDCA');
  310. $GLOBALS['TL_HOOKS']['reviseTable'][]                         = array('PCT\CustomElements\Helper\DcaHelper''clearSession');