YiiFoundation
  • Namespace
  • Class
  • Tree

Namespaces

  • foundation
    • enum
    • exception
    • helpers
    • widgets
      • base
  • PHP

Classes

  • Alert
  • ArrayHelper
  • Button
  • Foundation
  • Html
  • Icon
  • Nav
  • Panel
  • Pricing
  • Progress
  • Typo
  1 <?php
  2 /**
  3  * @copyright Copyright &copy; 2amigOS! Consulting Group 2013-
  4  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
  5  * @package foundation.components
  6  * @version 1.0.0
  7  */
  8 namespace foundation\helpers;
  9 
 10 /**
 11  * Typo facilitates the rendering of HTML components as specified on Typography section at Foundation's site. Most
 12  * common are not included as we believe they can be easily done with [[\CHtml]] yii helper class.
 13  *
 14  * @see http://foundation.zurb.com/docs/components/type.html
 15  *
 16  * @author Antonio Ramirez <amigo.cobos@gmail.com>
 17  * @package foundation\helpers
 18  */
 19 class Typo
 20 {
 21     /**
 22      * Renders a subheader
 23      * @param string $text the text to render within
 24      * @param string $tag the header tag to render. From h1 till h6.
 25      * @return string the generated subheader
 26      */
 27     public static function subHeader($text, $tag = 'h1')
 28     {
 29         return \CHtml::tag($tag, array('class' => 'subheader'), $text);
 30     }
 31 
 32     /**
 33      * Makes a text italic.
 34      * @param string $text the text to make italic
 35      * @return string the generated tag
 36      */
 37     public static function i($text)
 38     {
 39         return \CHtml::tag('em', $text);
 40     }
 41 
 42     /**
 43      * Renders a blockquote. Included as they have special style for them.
 44      * @param string $text the text to render within the blockquote
 45      * @return string the generated blockquote
 46      */
 47     public static function blockquote($text)
 48     {
 49         return \CHtml::tag('blockquote', $text);
 50     }
 51 
 52     /**
 53      * Renders a handy microformat-friendly list for addresses
 54      * @param string $name
 55      * @param string $address
 56      * @param string $locality
 57      * @param string $state
 58      * @param string $zip
 59      * @param string $email
 60      * @return string the generated vcard
 61      */
 62     public static function vCard($name, $address = '', $locality = '', $state = '', $zip = '', $email = '')
 63     {
 64         $items   = array();
 65         $items[] = \CHtml::tag('li', array('class' => 'fn'), $name);
 66         $items[] = \CHtml::tag('li', array('class' => 'street-address'), $address);
 67         $items[] = \CHtml::tag('li', array('class' => 'locality'), $locality);
 68         $sub     = array();
 69         $sub[]   = \CHtml::tag('span', array('class' => 'state'), $state);
 70         $sub[]   = \CHtml::tag('span', array('class' => 'zip'), $zip);
 71         $items[] = \CHtml::tag('li', array(), implode(", ", $sub));
 72         $items[] = \CHtml::tag('li', array('class' => 'email'), $email);
 73 
 74         return \CHtml::tag('ul', array('class' => 'vcard'), implode("\n", $items));
 75     }
 76 
 77     /**
 78      * Renders and inline list
 79      * @param array $items the items to render
 80      * @return string the generated list
 81      */
 82     public static function inlineList($items)
 83     {
 84         $listItems = array();
 85 
 86         foreach ($items as $item) {
 87             $listItems[] = \CHtml::tag('li', array(), $item);
 88         }
 89 
 90         if (!empty($listItems)) {
 91             return \CHtml::tag('ul', implode("\n", $listItems));
 92         }
 93     }
 94 
 95     /**
 96      * Renders a Foundation label
 97      * @param string $text the text to render within the label
 98      * @param array $htmlOptions the HTML attributes
 99      * @return string the generated label
100      */
101     public static function label($text, $htmlOptions = array())
102     {
103         ArrayHelper::addValue('class', 'label', $htmlOptions);
104         return \CHtml::tag('span', $htmlOptions, $text);
105     }
106 
107     /**
108      * Renders a special kbd tag
109      * @param string $text the text (command) to render within
110      * @return string the generated tag
111      */
112     public static function kbd($text)
113     {
114         return \CHtml::tag('kbd', $text);
115     }
116 }
117 
YiiFoundation API documentation generated by ApiGen 2.8.0