| 1 |
<?php |
| 2 |
|
| 3 |
namespace ResponsiveMenu\ViewModels; |
| 4 |
use ResponsiveMenu\Collections\OptionsCollection; |
| 5 |
use ResponsiveMenu\ViewModels\Components\ComponentFactory; |
| 6 |
|
| 7 |
class Menu { |
| 8 |
|
| 9 |
public function __construct(ComponentFactory $factory) { |
| 10 |
$this->factory = $factory; |
| 11 |
} |
| 12 |
|
| 13 |
public function getHtml(OptionsCollection $options) { |
| 14 |
$content = ''; |
| 15 |
|
| 16 |
foreach(json_decode($options['items_order']) as $key => $val) |
| 17 |
if($val == 'on') |
| 18 |
$content .= $this->factory->build($key)->render($options); |
| 19 |
|
| 20 |
return $content; |
| 21 |
} |
| 22 |
|
| 23 |
} |
| 24 |
|