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 */
11class syntax_plugin_structpublish_table extends syntax_plugin_struct_serial
12{
13    protected $tableclass = AggregationTable::class;
14
15    /** @inheritdoc */
16    public function connectTo($mode)
17    {
18        $this->Lexer->addSpecialPattern('----+ *structpublish *-+\n.*?\n?----+', $mode, 'plugin_structpublish_table');
19    }
20
21    /** @inheritdoc */
22    protected function addTypeFilter($config)
23    {
24        $config['schemas'][] = ['structpublish', 'structpublish'];
25        array_unshift($config['cols'], '%pageid%');
26        $config['filter'][] = [
27            '%rowid%',
28            '!=',
29            (string) \dokuwiki\plugin\struct\meta\AccessTablePage::DEFAULT_PAGE_RID,
30            'AND'
31        ];
32        $config['withpid'] = 1; // flag for the editor to distinguish data types
33        return $config;
34    }
35}
36