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 * Connect serial pattern to lexer. 16 * 17 * @param string $mode Parser mode 18 */ 19 public function connectTo($mode) 20 { 21 $this->Lexer->addSpecialPattern('----+ *struct serial *-+\n.*?\n----+', $mode, 'plugin_struct_serial'); 22 } 23 24 /** 25 * Filter based on primary key columns 26 * 27 * @param array $config 28 * @return array 29 */ 30 protected function addTypeFilter($config) 31 { 32 // we get the main ID instead of using $ID, so that serial data entry can be used via includes 33 // $INFO is not set yet so it can't be used 34 $id = getID(); 35 $config['filter'][] = ['%rowid%', '!=', (string)AccessTablePage::DEFAULT_PAGE_RID, 'AND']; 36 $config['filter'][] = ['%pageid%', '=', $id, 'AND']; 37 $config['withpid'] = 1; // flag for the editor to distinguish data types 38 return $config; 39 } 40} 41