PMA\libraries\ThemeManager::getHtmlSelectBox PHP Method

getHtmlSelectBox() public method

returns HTML selectbox, with or without form enclosed
public getHtmlSelectBox ( boolean $form = true ) : string
$form boolean whether enclosed by from tags or not
return string
    public function getHtmlSelectBox($form = true)
    {
        $select_box = '';
        if ($form) {
            $select_box .= '<form name="setTheme" method="get"';
            $select_box .= ' action="index.php" class="disableAjax">';
            $select_box .= URL::getHiddenInputs();
        }
        $theme_preview_path = './themes.php';
        $theme_preview_href = '<a href="' . $theme_preview_path . '" target="themes" class="themeselect">';
        $select_box .= $theme_preview_href . __('Theme:') . '</a>' . "\n";
        $select_box .= '<select name="set_theme" lang="en" dir="ltr"' . ' class="autosubmit">';
        foreach ($this->themes as $each_theme_id => $each_theme) {
            $select_box .= '<option value="' . $each_theme_id . '"';
            if ($this->active_theme === $each_theme_id) {
                $select_box .= ' selected="selected"';
            }
            $select_box .= '>' . htmlspecialchars($each_theme->getName()) . '</option>';
        }
        $select_box .= '</select>';
        if ($form) {
            $select_box .= '</form>';
        }
        return $select_box;
    }

Usage Example

 /**
  * Test for ThemeManager::getHtmlSelectBox
  *
  * @return void
  */
 public function testHtmlSelectBox()
 {
     $tm = new ThemeManager();
     $this->assertContains('<option value="pmahomme" selected="selected">', $tm->getHtmlSelectBox());
 }