Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /***************************************************************
- * Copyright notice
- *
- * (c) 2012 Christian Bülter (kennziffer.com) <buelter@kennziffer.com>
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
- class KeSearchExtenedPagesIndexer {
- /**
- * Adds the custom indexer to the TCA of indexer configurations, so that
- * it's selectable in the backend as an indexer type when you create a
- * new indexer configuration.
- *
- * @param array $params
- * @param type $pObj
- */
- function registerIndexerConfiguration(&$params, $pObj) {
- // add item to "type" field
- $newArray = array(
- 'Extend pages',
- 'extended_pages',
- \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('example') . 'Resources/Public/Icons/kesearch-indexer-extend_pages.gif'
- );
- $params['items'][] = $newArray;
- // enable fields in indexer config
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['fileext']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['index_content_with_restrictions']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['index_use_page_tags_for_files']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['single_pages']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['startingpoints_recursive']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['targetpid']['displayCond'] .= ',extended_pages';
- $GLOBALS['TCA']['tx_kesearch_indexerconfig']['columns']['targetpid']['displayCond'] .= ',extended_pages';
- }
- /**
- * Custom indexer for ke_search
- *
- * @param array $indexerConfig Configuration from TYPO3 Backend
- * @param array $indexerObject Reference to indexer class.
- * @return string Output.
- */
- public function customIndexer(&$indexerConfig, &$indexerObject) {
- if($indexerConfig['type'] == 'extended_pages') {
- $content = '';
- // Create new instance from tx_kesearch_indexer_types_page
- $keseachIndexerTypesPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_kesearch_indexer_types_page');
- $keseachIndexerTypesPage->pObj = $indexerObject;
- $keseachIndexerTypesPage->indexerConfig = $indexerConfig;
- // Add own CTypes
- $ownCTypes = array(
- 'example_1',
- 'example_2',
- 'example_3',
- );
- $keseachIndexerTypesPage->indexCTypes = array_merge($keseachIndexerTypesPage->indexCTypes, $ownCTypes);
- foreach ($keseachIndexerTypesPage->indexCTypes as $value) {
- $cTypes[] = 'CType="' . $value . '"';
- }
- $keseachIndexerTypesPage->whereClauseForCType = implode(' OR ', $cTypes);
- // Start indexing
- $content = $keseachIndexerTypesPage->startIndexing();
- return $content;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement