68 lines
No EOL
2.4 KiB
PHP
68 lines
No EOL
2.4 KiB
PHP
<?php
|
|
|
|
class PluginSettings
|
|
{
|
|
|
|
public static function bool($plugin,$settingName, $title, $description = "")
|
|
{
|
|
|
|
global $L;
|
|
|
|
$html = '<div class="mb-3">';
|
|
$html .= '<label class="form-label" for="'.$settingName.'">' . $L->get($title) . '</label>';
|
|
$html .= '<select class="form-select" id="'.$settingName.'" name="'.$settingName.'">';
|
|
$html .= '<option value="false" ' . ($plugin->getValue($settingName) === false ? 'selected' : '') . '>' . $L->get('Disabled') . '</option>';
|
|
$html .= '<option value="true" ' . ($plugin->getValue($settingName) === true ? 'selected' : '') . '>' . $L->get('Enabled') . '</option>';
|
|
$html .= '</select>';
|
|
if ($description != "") {
|
|
$html .= '<div class="form-text">' . $L->get($description) . '</div>';
|
|
}
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
public static function values($plugin, $settingName, $title, $values, $description = "")
|
|
{
|
|
|
|
global $L;
|
|
|
|
$html = '<div class="mb-3">';
|
|
$html .= '<label class="form-label" for="'.$settingName.'">' . $L->get($title) . '</label>';
|
|
$html .= '<select class="form-select" id="'.$settingName.'" name="'.$settingName.'">';
|
|
foreach ($values as $key => $value) {
|
|
$html .= '<option value="'.$key.'" ' . ($plugin->getValue($settingName) == $key ? 'selected' : '') . '>' . $L->get($value) . '</option>';
|
|
}
|
|
|
|
$html .= '</select>';
|
|
if ($description != "") {
|
|
$html .= '<div class="form-text">' . $L->get($description) . '</div>';
|
|
}
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
|
|
public static function medias($plugin, $settingName, $title, $description = "")
|
|
{
|
|
|
|
global $L;
|
|
global $medias;
|
|
|
|
$html = '<div class="mb-3">';
|
|
$html .= '<label class="form-label" for="'.$settingName.'">' . $L->get($title) . '</label>';
|
|
$html .= '<select class="form-select" id="'.$settingName.'" name="'.$settingName.'">';
|
|
$html .= '<option value="" ' . ($plugin->getValue($settingName) == '' ? 'selected' : '') . '>' . $L->get('None') . '</option>';
|
|
foreach ($medias->content() as $key=>$media) {
|
|
$html .= '<option value="'.$key.'" ' . ($plugin->getValue($settingName) == $key ? 'selected' : '') . '>' . $media->name() . '</option>';
|
|
}
|
|
|
|
$html .= '</select>';
|
|
if ($description != "") {
|
|
$html .= '<div class="form-text">' . $L->get($description) . '</div>';
|
|
}
|
|
$html .= '</div>';
|
|
|
|
return $html;
|
|
}
|
|
} |