Advertisement
cutgah

RealUrlConf.php

Jun 2nd, 2017
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.14 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Micke\GenCore;
  4.  
  5. class RealUrlConf {
  6.  
  7.     protected function mergeAndReturn($config, $overrule) {
  8.         \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $overrule, TRUE, TRUE, TRUE);
  9.         return $config;
  10.     }
  11.  
  12.     /**
  13.      * Function creating or altering the postVarSets conf section of RealURL
  14.      * Define the page parameter for paginations
  15.      *
  16.      * @param array                  $conf  The original config array
  17.      * @param tx_realurl_autoconfgen $pObj  The realurl autoConf object
  18.      * @return array                        The realurl conf array
  19.      */
  20.     public function realUrlConfigurer($conf, &$pObj) {
  21.  
  22.         // $newsDetailPids = ['60', '71', '24'];
  23.         // $newsFilterPids = ['72'];
  24.         // $newsCategoryPids = ['61'];
  25.         // $newsTagPids = [];
  26.  
  27.         $configuration = array(
  28.             'fixedPostVars' => array(
  29.                 'newsFilterConfiguration' => array(
  30.                     array(
  31.                         'GETvar' => 'tx_news_pi1[overwriteDemand][year]',
  32.                     ),
  33.                     array(
  34.                         'GETvar' => 'tx_news_pi1[overwriteDemand][month]',
  35.                     ),
  36.                 ),
  37.                 'newsDetailConfiguration' => array(
  38.                     array(
  39.                         'GETvar' => 'tx_news_pi1[year]',
  40.                     ),
  41.                     array(
  42.                         'GETvar' => 'tx_news_pi1[month]',
  43.                         'noMatch' => 'bypass',
  44.                     ),
  45.                     array(
  46.                         'GETvar' => 'tx_news_pi1[day]',
  47.                         'noMatch' => 'bypass',
  48.                     ),
  49.                     array(
  50.                         'GETvar' => 'tx_news_pi1[action]',
  51.                         'noMatch' => 'bypass',
  52.                     ),
  53.                     array(
  54.                         'GETvar' => 'tx_news_pi1[controller]',
  55.                         'noMatch' => 'bypass',
  56.                     ),
  57.                     array(
  58.                         'GETvar' => 'tx_news_pi1[mode]',
  59.                         'noMatch' => 'bypass',
  60.                     ),
  61.                     array(
  62.                         'GETvar' => 'tx_news_pi1[news]',
  63.                         'lookUpTable' => array(
  64.                             'table' => 'tx_news_domain_model_news',
  65.                             'id_field' => 'uid',
  66.                             'alias_field' => 'title',
  67.                             'addWhereClause' => ' AND NOT deleted',
  68.                             'useUniqueCache' => 1,
  69.                             'useUniqueCache_conf' => array(
  70.                                 'strtolower' => 1,
  71.                                 'spaceCharacter' => '-',
  72.                             ),
  73.                             'languageGetVar' => 'L',
  74.                             'languageExceptionUids' => '',
  75.                             'languageField' => 'sys_language_uid',
  76.                             'transOrigPointerField' => 'l10n_parent',
  77.                             'expireDays' => 180,
  78.                         ),
  79.                     ),
  80.                 ),
  81.                 'newsCategoryConfiguration' => array(
  82.                     array(
  83.                         'GETvar' => 'tx_news_pi1[overwriteDemand][categories]',
  84.                         'noMatch' => 'bypass',
  85.                         'lookUpTable' => array(
  86.                             'table' => 'sys_category',
  87.                             'id_field' => 'uid',
  88.                             'alias_field' => 'title',
  89.                             'addWhereClause' => ' AND NOT deleted',
  90.                             'useUniqueCache' => 1,
  91.                             'useUniqueCache_conf' => array(
  92.                                 'strtolower' => 1,
  93.                                 'spaceCharacter' => '-'
  94.                             )
  95.                         )
  96.                     )
  97.                 ),
  98.                 'newsTagConfiguration' => array(
  99.                     array(
  100.                         'GETvar' => 'tx_news_pi1[overwriteDemand][tags]',
  101.                         'lookUpTable' => array(
  102.                             'table' => 'tx_news_domain_model_tag',
  103.                             'id_field' => 'uid',
  104.                             'alias_field' => 'title',
  105.                             'addWhereClause' => ' AND NOT deleted',
  106.                             'useUniqueCache' => 1,
  107.                             'useUniqueCache_conf' => array(
  108.                                 'strtolower' => 1,
  109.                                 'spaceCharacter' => '-'
  110.                             )
  111.                         )
  112.                     )
  113.                 ),
  114.             ),
  115.             'postVarSets' => array(
  116.                 '_DEFAULT' => array(
  117.                     'controller' => array(
  118.                         array(
  119.                             'GETvar' => 'tx_news_pi1[action]',
  120.                             'noMatch' => 'bypass'
  121.                         ),
  122.                         array(
  123.                             'GETvar' => 'tx_news_pi1[controller]',
  124.                             'noMatch' => 'bypass'
  125.                         ),
  126.                     ),
  127.                     'page' => array(
  128.                         array(
  129.                             'GETvar' => 'tx_news_pi1[@widget_0][currentPage]',
  130.                         ),
  131.                     ),
  132.                 ),
  133.             ),
  134.         );
  135.  
  136.         // Apply postFixedVars configuration to pages
  137.         // if (!empty($newsDetailPids)) {
  138.         //     foreach ($newsDetailPids as $pid) {
  139.         //         $configuration['fixedPostVars'][$pid] = 'newsDetailConfiguration';
  140.         //     }
  141.         // };
  142.         // if (!empty($newsFilterPids)) {
  143.         //     foreach ($newsFilterPids as $pid) {
  144.         //         $configuration['fixedPostVars'][$pid] = 'newsFilterConfiguration';
  145.         //     }
  146.         // };
  147.         // if (!empty($newsCategoryPids)) {
  148.         //     foreach ($newsCategoryPids as $pid) {
  149.         //         $configuration['fixedPostVars'][$pid] = 'newsCategoryConfiguration';
  150.         //     }
  151.         // };
  152.         // if (!empty($newsCategoryPids)) {
  153.         //     foreach ($newsCategoryPids as $pid) {
  154.         //         $configuration['fixedPostVars'][$pid] = 'newsTagConfiguration';
  155.         //     }
  156.         // };
  157.  
  158.         // Merge with conf from RealURL
  159.         $overrule = $configuration;
  160.         return $this->mergeAndReturn($conf['config'], $overrule);
  161.     }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement