1<?php 2 3use dokuwiki\plugin\struct\meta\AggregationTable; 4 5/** 6 * DokuWiki Plugin structpublish (Syntax Component) 7 * 8 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 9 * @author Anna Dabrowska <dokuwiki@cosmocode.de> 10 */ 11 12class syntax_plugin_structpublish_table extends syntax_plugin_struct_serial 13{ 14 protected $tableclass = AggregationTable::class; 15 16 /** 17 * Connect pattern 18 * 19 * @param string $mode Parser mode 20 */ 21 public function connectTo($mode) 22 { 23 $this->Lexer->addSpecialPattern('----+ *structpublish *-+\n.*?\n?----+', $mode, 'plugin_structpublish_table'); 24 } 25 26 /** 27 * Will pass our database helper with overwritten IS_PUBLISHER() to Search 28 * 29 * @return helper_plugin_sqlite 30 */ 31 protected function getDb() 32 { 33 /** @var helper_plugin_structpublish_db $helper */ 34 $helper = plugin_load('helper', 'structpublish_db'); 35 return $helper->getDB(); 36 } 37 38 /** 39 * Filter based on primary key columns 40 * 41 * @param array $config 42 * @return array 43 */ 44 protected function addTypeFilter($config) 45 { 46 $config['schemas'][] = ['structpublish', 'structpublish']; 47 array_unshift($config['cols'], '%pageid%'); 48 $config['filter'][] = [ 49 '%rowid%', '!=', 50 (string)\dokuwiki\plugin\struct\meta\AccessTablePage::DEFAULT_PAGE_RID, 'AND' 51 ]; 52 $config['withpid'] = 1; // flag for the editor to distinguish data types 53 return $config; 54 } 55} 56 57