diff options
Diffstat (limited to 'platform/www/lib/plugins/config/core/Setting/SettingUndefined.php')
-rw-r--r-- | platform/www/lib/plugins/config/core/Setting/SettingUndefined.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/platform/www/lib/plugins/config/core/Setting/SettingUndefined.php b/platform/www/lib/plugins/config/core/Setting/SettingUndefined.php new file mode 100644 index 0000000..fa46a9f --- /dev/null +++ b/platform/www/lib/plugins/config/core/Setting/SettingUndefined.php @@ -0,0 +1,40 @@ +<?php + +namespace dokuwiki\plugin\config\core\Setting; + +use dokuwiki\plugin\config\core\Configuration; + +/** + * A do-nothing class used to detect settings with no metadata entry. + * Used internaly to hide undefined settings, and generate the undefined settings list. + */ +class SettingUndefined extends SettingHidden { + + protected $errorMessage = '_msg_setting_undefined'; + + /** @inheritdoc */ + public function shouldHaveDefault() { + return false; + } + + /** @inheritdoc */ + public function html(\admin_plugin_config $plugin, $echo = false) { + // determine the name the meta key would be called + if(preg_match( + '/^(?:plugin|tpl)' . Configuration::KEYMARKER . '.*?' . Configuration::KEYMARKER . '(.*)$/', + $this->getKey(), + $undefined_setting_match + )) { + $undefined_setting_key = $undefined_setting_match[1]; + } else { + $undefined_setting_key = $this->getKey(); + } + + $label = '<span title="$meta[\'' . $undefined_setting_key . '\']">$' . + 'conf' . '[\'' . $this->getArrayKey() . '\']</span>'; + $input = $plugin->getLang($this->errorMessage); + + return array($label, $input); + } + +} |