SettingUndefined.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace dokuwiki\plugin\config\core\Setting;
  3. use dokuwiki\plugin\config\core\Configuration;
  4. /**
  5. * A do-nothing class used to detect settings with no metadata entry.
  6. * Used internaly to hide undefined settings, and generate the undefined settings list.
  7. */
  8. class SettingUndefined extends SettingHidden {
  9. protected $errorMessage = '_msg_setting_undefined';
  10. /** @inheritdoc */
  11. public function shouldHaveDefault() {
  12. return false;
  13. }
  14. /** @inheritdoc */
  15. public function html(\admin_plugin_config $plugin, $echo = false) {
  16. // determine the name the meta key would be called
  17. if(preg_match(
  18. '/^(?:plugin|tpl)' . Configuration::KEYMARKER . '.*?' . Configuration::KEYMARKER . '(.*)$/',
  19. $this->getKey(),
  20. $undefined_setting_match
  21. )) {
  22. $undefined_setting_key = $undefined_setting_match[1];
  23. } else {
  24. $undefined_setting_key = $this->getKey();
  25. }
  26. $label = '<span title="$meta[\'' . $undefined_setting_key . '\']">$' .
  27. 'conf' . '[\'' . $this->getArrayKey() . '\']</span>';
  28. $input = $plugin->getLang($this->errorMessage);
  29. return array($label, $input);
  30. }
  31. }