TbHtml::em PHP Method

em() public static method

Generates an emphasized text.
public static em ( string $text, array $htmlOptions = [], string $tag = 'p' ) : string
$text string the text to emphasize.
$htmlOptions array additional HTML attributes.
$tag string the HTML tag.
return string the generated text.
    public static function em($text, $htmlOptions = array(), $tag = 'p')
    {
        $color = TbArray::popValue('color', $htmlOptions);
        if (TbArray::popValue('muted', $htmlOptions, false)) {
            self::addCssClass('muted', $htmlOptions);
        } else {
            if (!empty($color)) {
                self::addCssClass('text-' . $color, $htmlOptions);
            }
        }
        return self::tag($tag, $htmlOptions, $text);
    }

Usage Example

Example #1
0
 public function testEmphasize()
 {
     $I = $this->codeGuy;
     $html = TbHtml::em('Warning text', array('color' => TbHtml::TEXT_COLOR_WARNING));
     $span = $I->createNode($html, 'p.text-warning');
     $I->seeNodeText($span, 'Warning text');
     $html = TbHtml::em('Success text', array('color' => TbHtml::TEXT_COLOR_SUCCESS), 'span');
     $span = $I->createNode($html, 'span.text-success');
     $I->seeNodeText($span, 'Success text');
 }
All Usage Examples Of TbHtml::em
TbHtml