1<?php
2
3use dokuwiki\plugin\struct\meta\AccessTablePage;
4use dokuwiki\plugin\struct\meta\AggregationTable;
5
6/**
7 * DokuWiki Plugin structpublish (Syntax Component)
8 *
9 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
10 * @author  Anna Dabrowska <dokuwiki@cosmocode.de>
11 */
12class syntax_plugin_structpublish_table extends syntax_plugin_struct_serial
13{
14    protected $tableclass = AggregationTable::class;
15
16    /** @inheritdoc */
17    public function connectTo($mode)
18    {
19        $this->Lexer->addSpecialPattern('----+ *structpublish *-+\n.*?\n?----+', $mode, 'plugin_structpublish_table');
20    }
21
22    /** @inheritdoc */
23    protected function addTypeFilter($config)
24    {
25        $config['schemas'][] = ['structpublish', 'structpublish'];
26        array_unshift($config['cols'], '%pageid%');
27        $config['filter'][] = [
28            '%rowid%',
29            '!=',
30            (string) AccessTablePage::DEFAULT_PAGE_RID,
31            'AND'
32        ];
33        $config['withpid'] = 1; // flag for the editor to distinguish data types
34        return $config;
35    }
36}
37