Gruppen können angelegt und bearbeitet werden
Teili können angelegt werden
This commit is contained in:
24
components/partials/date-element.php
Normal file
24
components/partials/date-element.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
function _kompass_print_datebox($settingName, $settingValue, $style = '') {
|
||||
echo '<input style="' . $style . '" type="date" name="' . $settingName . '" value="' . $settingValue. '" />';
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_print_datebox(array $args) {
|
||||
if (!isset($args['setting'])) {
|
||||
wp_die('Missing argument setting at text-element ' . print_r($args, true));
|
||||
}
|
||||
$setting = get_option($args['setting'], null);
|
||||
$setting = $setting ?? ( $args['value'] ?? '' );
|
||||
|
||||
$style = isset($args['style']) ? $args['style'] : '';
|
||||
|
||||
$value = esc_attr($setting);
|
||||
|
||||
if ($value === null && isset($args['value'])) {
|
||||
$value = $args['value'];
|
||||
}
|
||||
_kompass_print_datebox($args['setting'], $value, $style);
|
||||
}
|
18
components/partials/form-start.php
Normal file
18
components/partials/form-start.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function kompass_prepare_form($params = [])
|
||||
{
|
||||
if (isset($params['page'])) {
|
||||
echo ' <form method="post" action="admin.php?page=' .$params['page'] . '">';
|
||||
}
|
||||
|
||||
echo '<input type="hidden" name="update_options" value="true" />';
|
||||
foreach ($params as $key => $value) {
|
||||
echo '<input type="hidden" name="' . $key . '" value="' . $value . '">';
|
||||
}
|
||||
}
|
||||
|
||||
function kompass_close_form(string $buttonText)
|
||||
{
|
||||
submit_button($buttonText,'button');
|
||||
echo '</form>';
|
||||
}
|
8
components/partials/message-box.php
Normal file
8
components/partials/message-box.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
function kompass_print_message_box(string $message, string $type = 'success')
|
||||
{
|
||||
echo '<div class="notice notice-' . $type .'" style="padding: 5px 10px;">';
|
||||
echo $message;
|
||||
echo '</div>';
|
||||
|
||||
}
|
@ -1,13 +1,18 @@
|
||||
<?php
|
||||
function kompass_print_textbox($settingName, $settingValue, $style = '') {
|
||||
function _kompass_print_textbox($settingName, $settingValue, $style = '') {
|
||||
echo '<input style="' . $style . '" type="text" name="' . $settingName . '" value="' . $settingValue. '" />';
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
||||
|
||||
function _kompass_limit_logins_settings_callback(array $args) {
|
||||
function kompass_print_textbox(array $args) {
|
||||
if (!isset($args['setting'])) {
|
||||
wp_die('Missing argument setting at text-element ' . print_r($args, true));
|
||||
}
|
||||
$setting = get_option($args['setting'], null);
|
||||
$setting = $setting ?? ( $args['value'] ?? '' );
|
||||
|
||||
$style = isset($args['style']) ? $args['style'] : '';
|
||||
|
||||
$value = esc_attr($setting);
|
||||
@ -15,5 +20,8 @@ function _kompass_limit_logins_settings_callback(array $args) {
|
||||
$value = (int)$value / (int)$args['unit_division'];
|
||||
}
|
||||
|
||||
kompass_print_textbox($args['setting'], $value, $style);
|
||||
if ($value === null && isset($args['value'])) {
|
||||
$value = $args['value'];
|
||||
}
|
||||
_kompass_print_textbox($args['setting'], $value, $style);
|
||||
}
|
||||
|
Reference in New Issue
Block a user