build_selector returns HTMLElement
This commit is contained in:
parent
7ee31db5c6
commit
84d232ca0d
3 changed files with 7 additions and 8 deletions
|
@ -202,7 +202,7 @@ class BaseThemelet
|
|||
* @param bool $empty_option Whether the first option should be an empty one.
|
||||
* @param array $selected_options The values of options that should be pre-selected.
|
||||
*/
|
||||
protected function build_selector(string $name, array $options, bool $required=false, bool $multiple=false, bool $empty_option=false, array $selected_options=[]): string
|
||||
protected function build_selector(string $name, array $options, bool $required=false, bool $multiple=false, bool $empty_option=false, array $selected_options=[]): HTMLElement
|
||||
{
|
||||
$attrs = [];
|
||||
if ($required) {
|
||||
|
@ -228,6 +228,6 @@ class BaseThemelet
|
|||
}
|
||||
}
|
||||
|
||||
return (string)$s;
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,7 @@ class PoolsTheme extends Themelet
|
|||
public function get_adder_html(Image $image, array $pools): string
|
||||
{
|
||||
$selector = $this->build_selector("pool_id", $pools);
|
||||
return "\n" . make_form(make_link("pool/add_post")) . "
|
||||
$selector
|
||||
return "\n" . make_form(make_link("pool/add_post")) . $selector . "
|
||||
<input type='hidden' name='image_id' value='{$image->id}'>
|
||||
<input type='submit' value='Add Post to Pool'>
|
||||
</form>
|
||||
|
@ -388,7 +387,7 @@ class PoolsTheme extends Themelet
|
|||
|
||||
public function get_bulk_pool_selector(array $options): string
|
||||
{
|
||||
return $this->build_selector("bulk_pool_select", $options, required: true, empty_option: true);
|
||||
return (string)$this->build_selector("bulk_pool_select", $options, required: true, empty_option: true);
|
||||
}
|
||||
|
||||
public function get_bulk_pool_input(array $search_terms): string
|
||||
|
|
|
@ -33,8 +33,8 @@ class RatingsTheme extends Themelet
|
|||
|
||||
$html = make_form(make_link("admin/update_ratings"))."<table class='form'>";
|
||||
|
||||
$html .= "<tr><th>Change</th><td>".$this->build_selector("rating_old", $current_ratings, required: true)."</td></tr>";
|
||||
$html .= "<tr><th>To</th><td>".$this->build_selector("rating_new", Ratings::get_ratings_dict(), required: true)."</td></tr>";
|
||||
$html .= "<tr><th>Change</th><td>" . $this->build_selector("rating_old", $current_ratings, required: true) . "</td></tr>";
|
||||
$html .= "<tr><th>To</th><td>" . $this->build_selector("rating_new", Ratings::get_ratings_dict(), required: true) . "</td></tr>";
|
||||
|
||||
$html .= "<tr><td colspan='2'><input type='submit' value='Update'></td></tr></table>
|
||||
</form>\n";
|
||||
|
@ -44,7 +44,7 @@ class RatingsTheme extends Themelet
|
|||
|
||||
public function get_selection_rater_html(array $selected_options, bool $multiple = false): string
|
||||
{
|
||||
return $this->build_selector("rating", Ratings::get_ratings_dict(), multiple: $multiple, empty_option: false, selected_options: $selected_options);
|
||||
return (string)$this->build_selector("rating", Ratings::get_ratings_dict(), multiple: $multiple, empty_option: false, selected_options: $selected_options);
|
||||
}
|
||||
|
||||
public function get_help_html(array $ratings): string
|
||||
|
|
Reference in a new issue