| 1 |
<?php |
| 2 |
|
| 3 |
namespace ResponsiveMenu\Form; |
| 4 |
use ResponsiveMenu\Models\Option; |
| 5 |
use ResponsiveMenu\Form\FormComponent; |
| 6 |
|
| 7 |
class Select { |
| 8 |
|
| 9 |
public function render(Option $option, array $select_data) { |
| 10 |
|
| 11 |
$html = "<div class='select-style'><select class='select' name='menu[{$option->getName()}]' id='{$option->getName()}'>"; |
| 12 |
foreach($select_data as $data) : |
| 13 |
$selected = $option->getValue() == $data['value'] ? " selected='selected'" : ""; |
| 14 |
$disabled = isset($data['disabled']) ? " disabled='disabled'" : ""; |
| 15 |
$pro = isset($data['disabled']) ? ' [PRO]' : ''; |
| 16 |
$html .= "<option value='{$data['value']}'{$selected}{$disabled}>{$data['display']}{$pro}</option>"; |
| 17 |
endforeach; |
| 18 |
$html .= "</select></div>"; |
| 19 |
return $html; |
| 20 |
} |
| 21 |
|
| 22 |
} |
| 23 |
|