1<?php
2/**
3 * Mikio Syntax Plugin: Button Group
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 */
9if (!defined('DOKU_INC')) die();
10if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11require_once(dirname(__FILE__).'/core.php');
12
13class syntax_plugin_mikioplugin_buttongroup extends syntax_plugin_mikioplugin_core {
14    public $tag                 = 'button-group';
15    public $requires_tag        = 'button';
16    public $hasEndTag           = true;
17    public $options             = array(
18        'size'          => array('type'     => 'choice',
19                                 'data'     => array('large'=> array('large', 'lg'), 'small' => array('small', 'sm')),
20                                 'default'  => ''),
21        'vertical'      => array('type'     => 'boolean',   'default'   => 'false'));
22
23    public function __construct() {
24        $this->addCommonOptions('align shadow');
25    }
26
27    public function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); }
28    public function getPType() { return 'normal'; }
29
30    public function render_lexer_enter(Doku_Renderer $renderer, $data) {
31        $classes = $this->buildClass($data, array('size', 'vertical'));
32
33        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'button-group' . $classes . '" role="group">';
34        $renderer->doc .= '<div class="' . $this->elemClass . ' ' . $this->classPrefix . 'button-group-inner" role="group">';
35    }
36
37
38    public function render_lexer_exit(Doku_Renderer $renderer, $data) {
39        $renderer->doc .= '</div></div>';
40    }
41}
42?>