1<?php
2/**
3 * Mikio Syntax Plugin: Accordion Item
4 *
5 * @link    http://github.com/nomadjimbob/mikioplugin
6 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author  James Collins <james.collins@outlook.com.au>
8 */
9
10if (!defined('DOKU_INC')) { die();
11}
12if (!defined('DOKU_PLUGIN')) { define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/');
13}
14require_once dirname(__FILE__).'/core.php';
15
16class syntax_plugin_mikioplugin_accordionitem extends syntax_plugin_mikioplugin_core
17{
18    public $tag                 = 'accordion-item';
19    public $requires_tag        = 'accordion';
20    public $hasEndTag           = true;
21    public $options             = array(
22        'title'         => array('type'     => 'text',      'default'   => ''),
23        'show'          => array('type'     => 'boolean',   'default'   => 'false'),
24    );
25
26    public function __construct()
27    {
28        $this->addCommonOptions('type text-align');
29    }
30
31    public function getAllowedTypes()
32    {
33        return array('container', 'formatting', 'substition', 'disabled', 'paragraphs', 'protected');
34    }
35
36    public function render_lexer_enter(Doku_Renderer $renderer, $data)
37    {
38        $classes = $this->buildClass($data, array('show'));
39
40        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-item' . $classes . '"><a href="#" class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-title">' . $data['title'] . '</a><div class="' . $this->elemClass . ' ' . $this->classPrefix . 'accordian-body">';
41    }
42
43
44    public function render_lexer_exit(Doku_Renderer $renderer, $data)
45    {
46        $renderer->doc .= '</div></div>';
47    }
48}
49?>