Hoa central
Tab.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Xyl\Interpreter\Html;
38 
39 use Hoa\Stream;
40 
49 class Tab extends GenericPhrasing
50 {
56  protected static $_attributes = [
57  'for' => parent::ATTRIBUTE_TYPE_NORMAL,
58  'selected' => parent::ATTRIBUTE_TYPE_NORMAL
59  ];
60 
66  protected static $_attributesMapping = [];
67 
68 
69 
76  protected function paint(Stream\IStream\Out $out)
77  {
78  $name = $this->getName();
79  $for = $this->abstract->readAttribute('for');
80  $selected = $this->abstract->readAttribute('aria-selected');
81 
82  if ('true' !== $selected) {
83  $selected = 'false';
84  }
85 
86  $this->writeAttribute('role', 'presentation');
87  $out->writeAll(
88  '<' . $name . $this->readAttributesAsString() . '>' .
89  '<a href="#' . $for . '" role="tab" aria-controls="' . $for . '" ' .
90  'aria-selected="' . $selected . '" tabindex="-1" ' .
91  'id="' . $for . '__tab">'
92  );
93  $this->computeValue($out);
94  $out->writeAll('</a></' . $name . '>');
95 
96  return;
97  }
98 
104  public function getName()
105  {
106  return 'li';
107  }
108 }
paint(Stream\IStream\Out $out)
Definition: Tab.php:76