[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/plugins/config/core/Setting/ -> SettingUndefined.php (source)

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