{assign var=error value=''}
{/if}
<dl class="{$option->optionName}Input">
- <dt><label for="{$option->optionName}">{lang}{@$langPrefix}{$option->optionName}{/lang}</label></dt>
+ <dt{if $optionData[cssClassName]} class="{$optionData[cssClassName]}"{/if}><label for="{$option->optionName}">{lang}{@$langPrefix}{$option->optionName}{/lang}</label></dt>
<dd>{@$optionData[html]}
{if $error}
<small class="innerError">
// add option to list
$children[] = array(
'object' => $option,
- 'html' => $html
+ 'html' => $html,
+ 'cssClassName' => $this->getTypeObject($option->optionType)->getCSSClassName()
);
$i++;
--- /dev/null
+<?php
+namespace wcf\system\option;
+use wcf\data\option\Option;
+
+/**
+ * Provides adefault implementation for object types.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2011 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.option
+ * @category Community Framework
+ */
+abstract class AbstractOptionType implements IOptionType {
+ /**
+ * @see wcf\system\option\IOptionType::validate()
+ */
+ public function validate(Option $option, $newValue) {}
+
+ /**
+ * @see wcf\system\option\IOptionType::getData()
+ */
+ public function getData(Option $option, $newValue) {
+ return $newValue;
+ }
+
+ /**
+ * @see wcf\system\option\IOptionType::getCSSClassName()
+ */
+ public function getCSSClassName() {
+ return '';
+ }
+}
* @return string
*/
public function getData(Option $option, $newValue);
+
+ /**
+ * Returns css class name for this form element.
+ *
+ * @return string
+ */
+ public function getCSSClassName();
}
* @subpackage system.option
* @category Community Framework
*/
-class OptionTypeBoolean implements IOptionType, ISearchableUserOption {
+class OptionTypeBoolean extends AbstractOptionType implements ISearchableUserOption {
/**
* @see wcf\system\option\IOptionType::getFormElement()
*/
return WCF::getTPL()->fetch('optionTypeBoolean');
}
- /**
- * @see wcf\system\option\IOptionType::validate()
- */
- public function validate(Option $option, $newValue) {}
-
/**
* @see wcf\system\option\IOptionType::getData()
*/
return 0;
}
+ /**
+ * @see wcf\system\option\IOptionType::getCSSClassName()
+ */
+ public function getCSSClassName() {
+ return 'reversed';
+ }
+
/**
* @see wcf\system\option\ISearchableUserOption::getSearchFormElement()
*/
* @subpackage system.option
* @category Community Framework
*/
-class OptionTypeDate implements IOptionType, ISearchableUserOption {
+class OptionTypeDate extends AbstractOptionType implements ISearchableUserOption {
protected $yearRequired = true;
/**
* @subpackage system.option
* @category Community Framework
*/
-class OptionTypeRadiobuttons implements IOptionType, ISearchableUserOption {
+class OptionTypeRadiobuttons extends AbstractOptionType implements ISearchableUserOption {
public $templateName = 'optionTypeRadiobuttons';
/**
}
}
- /**
- * @see wcf\system\option\IOptionType::getData()
- */
- public function getData(Option $option, $newValue) {
- return $newValue;
- }
-
/**
* @see wcf\system\option\ISearchableUserOption::getSearchFormElement()
*/
* @subpackage system.option
* @category Community Framework
*/
-class OptionTypeText implements IOptionType, ISearchableUserOption {
+class OptionTypeText extends AbstractOptionType implements ISearchableUserOption {
/**
* input type
* @var string
return WCF::getTPL()->fetch('optionTypeText');
}
- /**
- * @see wcf\system\option\IOptionType::validate()
- */
- public function validate(Option $option, $newValue) {}
-
- /**
- * @see wcf\system\option\IOptionType::getData()
- */
- public function getData(Option $option, $newValue) {
- return $newValue;
- }
-
/**
* @see wcf\system\option\ISearchableUserOption::getSearchFormElement()
*/
* @subpackage system.option
* @category Community Framework
*/
-class OptionTypeTimezone implements IOptionType {
+class OptionTypeTimezone extends AbstractOptionType {
/**
* @see wcf\system\option\IOptionType::getFormElement()
*/
throw new UserInputException($option->optionName, 'validationFailed');
}
}
-
- /**
- * @see wcf\system\option\IOptionType::getData()
- */
- public function getData(Option $option, $newValue) {
- return $newValue;
- }
}