10a5b05ebSAndreas Gohr<?php 20a5b05ebSAndreas Gohr 30a5b05ebSAndreas Gohrnamespace dokuwiki\plugin\config\core\Setting; 40a5b05ebSAndreas Gohr 5e7296041SAndreas Gohruse dokuwiki\plugin\config\core\Configuration; 6e7296041SAndreas Gohr 70a5b05ebSAndreas Gohr/** 80a5b05ebSAndreas Gohr * A do-nothing class used to detect settings with no metadata entry. 90a5b05ebSAndreas Gohr * Used internaly to hide undefined settings, and generate the undefined settings list. 100a5b05ebSAndreas Gohr */ 118c7c53b0SAndreas Gohrclass SettingUndefined extends SettingHidden 128c7c53b0SAndreas Gohr{ 13e7296041SAndreas Gohr protected $errorMessage = '_msg_setting_undefined'; 14e7296041SAndreas Gohr 150a5b05ebSAndreas Gohr /** @inheritdoc */ 16d868eb89SAndreas Gohr public function shouldHaveDefault() 17d868eb89SAndreas Gohr { 180a5b05ebSAndreas Gohr return false; 190a5b05ebSAndreas Gohr } 200a5b05ebSAndreas Gohr 21e7296041SAndreas Gohr /** @inheritdoc */ 22d868eb89SAndreas Gohr public function html(\admin_plugin_config $plugin, $echo = false) 23d868eb89SAndreas Gohr { 24e7296041SAndreas Gohr // determine the name the meta key would be called 25*7d34963bSAndreas Gohr if ( 26*7d34963bSAndreas Gohr preg_match( 27e7296041SAndreas Gohr '/^(?:plugin|tpl)' . Configuration::KEYMARKER . '.*?' . Configuration::KEYMARKER . '(.*)$/', 28e7296041SAndreas Gohr $this->getKey(), 29e7296041SAndreas Gohr $undefined_setting_match 30*7d34963bSAndreas Gohr ) 31*7d34963bSAndreas Gohr ) { 32e7296041SAndreas Gohr $undefined_setting_key = $undefined_setting_match[1]; 33e7296041SAndreas Gohr } else { 34e7296041SAndreas Gohr $undefined_setting_key = $this->getKey(); 35e7296041SAndreas Gohr } 36e7296041SAndreas Gohr 37e7296041SAndreas Gohr $label = '<span title="$meta[\'' . $undefined_setting_key . '\']">$' . 38e7296041SAndreas Gohr 'conf' . '[\'' . $this->getArrayKey() . '\']</span>'; 39e7296041SAndreas Gohr $input = $plugin->getLang($this->errorMessage); 40e7296041SAndreas Gohr 41467c1427SAndreas Gohr return [$label, $input]; 42e7296041SAndreas Gohr } 430a5b05ebSAndreas Gohr} 44