You are here

private static function TableTagPlugin::tabulateTree in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 standard/src/Plugin/XBBCode/TableTagPlugin.php \Drupal\xbbcode_standard\Plugin\XBBCode\TableTagPlugin::tabulateTree()

Helper that turns a parse tree into a table of cells.

Parameters

array $children: The parse tree under the table tag.

Return value

\Drupal\xbbcode\Parser\Tree\TagElementInterface[][] Array of rows, each row an array of cells, each cell a node element.

1 call to TableTagPlugin::tabulateTree()
TableTagPlugin::buildElement in standard/src/Plugin/XBBCode/TableTagPlugin.php
Build a render array from the tag.

File

standard/src/Plugin/XBBCode/TableTagPlugin.php, line 110

Class

TableTagPlugin
Renders a table.

Namespace

Drupal\xbbcode_standard\Plugin\XBBCode

Code

private static function tabulateTree(array $children) : array {
  $table = [];
  [
    $token,
    $text,
  ] = static::encodeTree($children);
  foreach (self::tabulateText($text) as $i => $row) {
    foreach ($row as $j => $cell) {
      $table[$i][$j] = self::decodeTree($cell, $children, $token);
    }
  }
  return $table;
}