1 <?php
2 /**
3 * @package Joomla.Libraries
4 * @subpackage Toolbar
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 /**
13 * Renders a button separator
14 *
15 * @since 3.0
16 */
17 class JToolbarButtonSeparator extends JToolbarButton
18 {
19 /**
20 * Button type
21 *
22 * @var string
23 */
24 protected $_name = 'Separator';
25
26 /**
27 * Get the HTML for a separator in the toolbar
28 *
29 * @param array &$definition Class name and custom width
30 *
31 * @return string The HTML for the separator
32 *
33 * @see JToolbarButton::render()
34 * @since 3.0
35 */
36 public function render(&$definition)
37 {
38 // Store all data to the options array for use with JLayout
39 $options = array();
40
41 // Separator class name
42 $options['class'] = empty($definition[1]) ? '' : $definition[1];
43
44 // Custom width
45 $options['style'] = empty($definition[2]) ? '' : ' style="width:' . (int) $definition[2] . 'px;"';
46
47 // Instantiate a new JLayoutFile instance and render the layout
48 $layout = new JLayoutFile('joomla.toolbar.separator');
49
50 return $layout->render($options);
51 }
52
53 /**
54 * Empty implementation (not required for separator)
55 *
56 * @return void
57 *
58 * @since 3.0
59 */
60 public function fetchButton()
61 {
62 }
63 }
64