1<?php 2 3/** 4 * DokuWiki Plugin struct (Syntax Component) 5 * 6 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 7 * @author Andreas Gohr, Michael Große, Anna Dabrowska <dokuwiki@cosmocode.de> 8 */ 9 10use dokuwiki\plugin\struct\meta\AccessTablePage; 11 12class syntax_plugin_struct_serial extends syntax_plugin_struct_global 13{ 14 15 /** 16 * Connect serial pattern to lexer. 17 * 18 * @param string $mode Parser mode 19 */ 20 public function connectTo($mode) 21 { 22 $this->Lexer->addSpecialPattern('----+ *struct serial *-+\n.*?\n----+', $mode, 'plugin_struct_serial'); 23 } 24 25 /** 26 * Filter based on primary key columns 27 * 28 * @param array $config 29 * @return array 30 */ 31 protected function addTypeFilter($config) 32 { 33 // we get the main ID instead of using $ID, so that serial data entry can be used via includes 34 // $INFO is not set yet so it can't be used 35 $id = getID(); 36 $config['filter'][] = ['%rowid%', '!=', (string)AccessTablePage::DEFAULT_PAGE_RID, 'AND']; 37 $config['filter'][] = ['%pageid%', '=', $id, 'AND']; 38 $config['withpid'] = 1; // flag for the editor to distinguish data types 39 return $config; 40 } 41} 42