Skip to content

Commit 1d4f2cc

Browse files
committed
Accordion for extends, children, and implements sections
1 parent 6e8f182 commit 1d4f2cc

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

src/PHPFUI/InstaDoc/Section/Doc.php

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ public function generate(\PHPFUI\Instadoc\PageInterface $page, string $fullClass
7373
$container->add($row);
7474
}
7575

76-
$table = new \PHPFUI\Table();
77-
$table->addClass('hover');
78-
$table->addClass('unstriped');
79-
$table->addClass('stack');
80-
8176
$parent = $this->reflection->getParentClass();
8277

8378
$parentNames = [];
@@ -91,38 +86,49 @@ public function generate(\PHPFUI\Instadoc\PageInterface $page, string $fullClass
9186
}
9287
}
9388

94-
$extends = $this->section('Extends');
89+
$accordion = new \PHPFUI\Accordion();
90+
$accordion->addAttribute('data-multi-expand', 'true');
91+
$accordion->addAttribute('data-allow-all-closed', 'true');
92+
93+
$table = new \PHPFUI\Table();
94+
$table->addClass('hover');
95+
$table->addClass('unstriped');
9596

9697
foreach (array_reverse($parentNames) as $name)
9798
{
98-
$table->addRow([$extends, $this->getClassName($name)]);
99-
$extends = '';
99+
$table->addRow([$this->getClassName($name)]);
100100
}
101+
$accordion->addTab('Extends', $table);
102+
101103

102-
$children = $this->section('Children');
104+
$table = new \PHPFUI\Table();
105+
$table->addClass('hover');
106+
$table->addClass('unstriped');
103107

104108
foreach (\PHPFUI\InstaDoc\ChildClasses::getChildClasses($this->class) as $class)
105109
{
106-
$table->addRow([$children, $this->getClassName($class)]);
107-
$children = '';
110+
$table->addRow([$this->getClassName($class)]);
108111
}
112+
$accordion->addTab('Children', $table);
109113

110114
$interfaces = $this->reflection->getInterfaces();
111115

112116
if ($interfaces)
113117
{
114118
ksort($interfaces, SORT_FLAG_CASE | SORT_STRING);
115-
$section = 'Implements';
119+
$table = new \PHPFUI\Table();
120+
$table->addClass('hover');
121+
$table->addClass('unstriped');
116122

117123
foreach ($interfaces as $interface)
118124
{
119125
$class = $interface->getName();
120-
$table->addRow([$this->section($section), $this->getClassName($interface->getName())]);
121-
$section = '';
126+
$table->addRow([$this->getClassName($interface->getName())]);
122127
}
128+
$accordion->addTab('Implements', $table);
123129
}
124130

125-
$container->add($table);
131+
$container->add($accordion);
126132

127133
$parent = $this->reflection->getParentClass();
128134

0 commit comments

Comments
 (0)