Overview

Namespaces

  • Cakestrap
    • View
      • Helper

Classes

  • Cakestrap\View\Helper\AlertHelper
  • Cakestrap\View\Helper\AssetHelper
  • Cakestrap\View\Helper\BadgeHelper
  • Cakestrap\View\Helper\Basic
  • Cakestrap\View\Helper\ButtonItemsHelper
  • Cakestrap\View\Helper\CakestrapHelper
  • Cakestrap\View\Helper\CallOutHelper
  • Cakestrap\View\Helper\CollapseHelper
  • Cakestrap\View\Helper\DropdownHelper
  • Cakestrap\View\Helper\ListGroupHelper
  • Cakestrap\View\Helper\ModalHelper
  • Cakestrap\View\Helper\PanelHelper
  • Cakestrap\View\Helper\TabHelper
  • Cakestrap\View\Helper\TableHelper
  • Cakestrap\View\Helper\Templates
  • Cakestrap\View\Helper\WellHelper
  • Overview
  • Namespace
  • Class
  1: <?php
  2: /**
  3:  * Copyright (c) CMNWorks
  4:  *
  5:  * Licensed under The MIT License
  6:  * For full copyright and license information, please see the LICENSE.txt
  7:  * Redistributions of files must retain the above copyright notice.
  8:  *
  9:  * @copyright     Copyright (c) CMNWorks Christopher M. Natan
 10:  * @author        Christopher M. Natan
 11:  * @link          http://cmnworks.com
 12:  * @since         1.8.8
 13:  * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 14:  */
 15: namespace Cakestrap\View\Helper;
 16: 
 17: /**
 18:  * List groups are a flexible and powerful component
 19:  * for displaying not only simple lists of elements,
 20:  * but complex ones with custom content.
 21:  *
 22:  * <code>
 23:  * <?php
 24:  * echo $this->Cakestrap->ListGroup()
 25:  *                      ->item("One")
 26:  *                      ->item("Two")
 27:  *                      ->item("Three")
 28:  *                      ->set()
 29:  * ?>
 30:  * </code>
 31:  *
 32:  * @package Cakestrap\View\Helper
 33:  * @link http://getbootstrap.com/components/#list-group
 34:  */
 35: class ListGroupHelper extends Basic
 36: {
 37: 
 38:     /**
 39:      * Default helper options.
 40:      * These options are merged with the user-provided options.
 41:      *
 42:      * @var array
 43:      */
 44:     protected  $_options  = [ 'class' => null ];
 45: 
 46:     /**
 47:      * An array to hold the list group item
 48:      *
 49:      * @var array
 50:      */
 51:     protected $_item = [];
 52: 
 53:     /**
 54:      * Set the  item
 55:      *
 56:      * @param string $item
 57:      * @return $this
 58:      */
 59:     public function item($item = null)
 60:     {
 61:         $this->_item[] = $this->_stringTemplate->format('item', ['item' => $item]);;
 62:         return $this;
 63:     }
 64: 
 65:     /**
 66:      * Set all the defined values.
 67:      * This will return the final html template.
 68:      *
 69:      * @return string
 70:      */
 71:     public function set()
 72:     {
 73:         $this->_setItem();
 74:         $this->_addToContainer();
 75:         $this->_reset();
 76: 
 77:         return $this->_container;
 78:     }
 79: 
 80:     /**
 81:      * Extract all the items
 82:      *
 83:      * @return void
 84:      */
 85:     protected function _setItem()
 86:     {
 87:         $item  = implode("", $this->_item);
 88:         $this->_item = $item;
 89:     }
 90: 
 91:     /**
 92:      * Add all items to parent container
 93:      *
 94:      * @return void
 95:      */
 96:     protected function _addToContainer()
 97:     {
 98:         $this->_container = $this->_stringTemplate->format('container', [
 99:             'container' => $this->_item,
100:             'class' => $this->_options['class']]);
101:     }
102: }
API documentation generated by ApiGen