Display contents using Drupal8 Render API | Drupal 8

Display contents using Drupal8 Render API

Submitted by editor on Tue, 01/12/2016 - 12:28
Question

How to show  contents  using Drupal8 Render API ?

 

Render arrays

 

Minimum:
        return  array(
            '#markup' => 'Hello. This is my First Page',
        );

Add / Manage allowed tags:
$output = array();
$output[] = array(
    '#markup' => '<strong>This is allowed</strong> <em>This is filtered</em>',
    '#allowed_tags' => ['strong'],
;

 

By default allowed tags (Not tested, To verify)
<p> <a> <em> <strong> <b> <i> <u> <strike> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <table> <tbody> <tr> <td> <th> <h1> <h2> <h3> <h4> <h5> <h6> <blockquote> <hr> <span> <br> <font> <sup> <sub> <div>

 

Source : https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/group/theme_render/8

Add new comment