diff options
author | Yaco <franco@reevo.org> | 2022-03-08 13:08:34 +0000 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2022-03-08 13:08:34 +0000 |
commit | c985c40d3f3fc6a2be3be3186df3bf2f32189475 (patch) | |
tree | cee11f5e5a7e351ee0fec36d58d72cbee4f7e49b /platform/www/lib/plugins/config/core/Setting/SettingUndefined.php |
first commit after acervus codebase
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); + } + +} |