codeBlock() public static method

Generates a code block.
public static codeBlock ( string $code, array $htmlOptions = [] ) : string
$code string the code.
$htmlOptions array additional HTML attributes.
return string the generated block.
Example #1
0
    <h2>Inline</h2>

    <div class="bs-docs-example">
        For example, <?php 
echo TbHtml::code('&lt;section>');
?>
 should be wrapped as inline.
    </div>
    <pre class="prettyprint linenums">
For example, &lt;?php echo TbHtml::code('&lt;section>'); ?> should be wrapped as inline.</pre>

    <h2>Code block</h2>

    <div class="bs-docs-example">
        <?php 
echo TbHtml::codeBlock('&lt;p>Sample text here...&lt;/p>');
?>
    </div>
    <pre class="prettyprint linenums">
&lt;?php echo TbHtml::codeBlock('&lt;p>Sample text here...&lt;/p>'); ?></pre>

</section>

<!-- Forms
    ================================================== -->
<section id="forms">

    <?php 
$dropdownConfig = array(array('label' => 'Action', 'url' => '#'), array('label' => 'Another action', 'url' => '#'), array('label' => 'Something else here', 'url' => '#'), TbHtml::menuDivider(), array('label' => 'Separate link', 'url' => '#'));
?>
Example #2
0
 public function testCodeBlock()
 {
     $I = $this->codeGuy;
     $html = TbHtml::codeBlock('Source code');
     $pre = $I->createNode($html, 'pre');
     $I->seeNodeText($pre, 'Source code');
 }