示例#1
0
 function testNested()
 {
     $hierarchy = new DynamicAxis();
     $hierarchy->addNames(['A.x', 'A.y', 'B.x']);
     $hierarchy->addName('A.x.22');
     $this->assertEquals(['A.x' => ['A.x.22' => true], 'A' => ['A.x' => true, 'A.y' => true], 'A.y' => [], 'B.x' => [], 'B' => ['B.x' => true], 'A.x.22' => []], $hierarchy->getChildren());
     $this->assertEquals(['A.x' => 'A', 'A.y' => 'A', 'B.x' => 'B', 'A' => null, 'B' => null, 'A.x.22' => 'A.x'], $hierarchy->getParents());
     $this->assertEquals(['A' => true, 'B' => true], $hierarchy->getToplevelNames());
     $snapshot = $hierarchy->takeSnapshot();
     $this->assertEquals(['A.x.22', 'A.y', 'B.x'], $snapshot->getLeafNames());
 }
示例#2
0
 /**
  * @param Axis $columns
  *   Either 'thead' or 'tbody' or 'tfoot'.
  * @param StaticAttributesMap $tableColAttributes
  *
  * @return string
  *   Rendered table section html.
  */
 function render(Axis $columns, StaticAttributesMap $tableColAttributes)
 {
     if ($this->rows->isEmpty() || !$columns->getCount()) {
         return '';
     }
     $container = new BuildContainer($this->rows->takeSnapshot(), $columns, $this->cellMap->getCells());
     /** @var BuildContainerBase $container */
     $container->OpenEndCells = $this->openEndMap->getNames();
     $container->RowAttributes = clone $this->rowAttributes->staticCopy();
     $container->RowStripings = $this->rowStripings;
     $container->TableColAttributes = $tableColAttributes;
     $container->SectionColAttributes = $this->colAttributes->staticCopy();
     /** @var BuildContainer $container */
     $innerHtml = $container->InnerHtml;
     return '  ' . $this->renderTag($this->tagName, "\n" . $innerHtml . '  ') . "\n";
 }