Hoa central
Tabpanel.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Xyl\Interpreter\Html;
38 
39 use Hoa\Xyl;
40 
49 class Tabpanel extends Generic implements Xyl\Element\Executable
50 {
56  public function preExecute()
57  {
58  $this->writeAttribute('role', 'tabpanel');
59  $atLeast = false;
60 
61  if (true === $this->abstract->attributeExists('aria-hidden')) {
62  $hidden = 'true' === $this->abstract->readAttribute('aria-hidden');
63  $this->writeAttribute('aria-hidden', $hidden ? 'true' : 'false');
64  $this->writeAttribute('aria-expanded', $hidden ? 'false' : 'true');
65  $atLeast = true;
66  }
67 
68  if (true === $this->abstract->attributeExists('aria-expanded')) {
69  $expanded = 'true' === $this->abstract->readAttribute('aria-expanded');
70  $this->writeAttribute('aria-expanded', $expanded ? 'true' : 'false');
71  $this->writeAttribute('aria-hidden', $expanded ? 'false' : 'true');
72  $atLeast = true;
73  }
74 
75  if (false === $atLeast) {
76  $this->writeAttribute('aria-hidden', 'true');
77  $this->writeAttribute('aria-expanded', 'false');
78  }
79 
80  // From <tabs />.
81  $this->writeAttribute(
82  'aria-labelledby',
83  $this->abstract->readAttribute('aria-labelledby')
84  );
85 
86  return;
87  }
88 
94  public function postExecute()
95  {
96  return;
97  }
98 
104  public function getName()
105  {
106  return 'div';
107  }
108 }