use wcf\system\form\builder\field\ItemListFormField;
use wcf\system\form\builder\field\SingleSelectionFormField;
use wcf\system\form\builder\field\TextFormField;
+use wcf\system\form\builder\field\validation\FormFieldValidatorUtil;
use wcf\system\form\builder\IFormDocument;
use wcf\system\Regex;
use wcf\system\WCF;
TextFormField::create('notificationObjectTypeCategory')
->objectProperty('category')
->label('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category')
- ->description('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description'),
- // TODO: validator
+ ->description('wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description')
+ ->addValidator(FormFieldValidatorUtil::getDotSeparatedStringValidator(
+ 'wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category',
+ 3
+ )),
BooleanFormField::create('notificationObjectTypeSupportsReactions')
->objectProperty('supportsReactions')
$page->appendChild($document->createElement('pageType', $data['pageType']));
+ $this->appendElementChildren(
+ $page,
+ ['controller' => '',],
+ $form
+ );
+
foreach ($formData['name_i18n'] as $languageID => $name) {
$name = $document->createElement('name', $this->getAutoCdataValue($name));
$name->setAttribute('language', LanguageFactory::getInstance()->getLanguage($languageID)->languageCode);
$page->appendChild($name);
}
- // TODO: use `appendElementChildren`
- $optionalElements = [
- 'controller', 'handler', 'controllerCustomURL', 'hasFixedParent',
- 'parent', 'options', 'permissions', 'cssClassName', 'allowSpidersToIndex',
- 'excludeFromLandingPage', 'availableDuringOfflineMode', 'requireObjectID'
- ];
-
- foreach ($optionalElements as $property) {
- if (!empty($data[$property])) {
- $page->appendChild($document->createElement($property, (string)$data[$property]));
+ $this->appendElementChildren(
+ $page,
+ [
+ 'handler' => '',
+ 'controllerCustomURL' => '',
+ 'hasFixedParent' => 0,
+ 'parent' => '',
+ 'options' => '',
+ 'permissions' => '',
+ 'cssClassName' => '',
+ 'allowSpidersToIndex' => 0,
+ 'excludeFromLandingPage' => 0,
+ 'availableDuringOfflineMode' => 0,
+ 'requireObjectID' => 0
+ ],
+ $form
+ );
}
}
}
})),
- // TODO: use field with code support
MultilineTextFormField::create('templateCode')
->objectProperty('templatecode')
->label('wcf.acp.pip.templateListener.templateCode')
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.condition.userSearch.data.title"><![CDATA[User Search Condition Data]]></item>
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.data.title"><![CDATA[Notification Object Type Data]]></item>
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category"><![CDATA[Category]]></item>
- <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description"><![CDATA[The category is used to group events on the notification settings page.]]></item>
+ <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.description"><![CDATA[The category is used to group events on the notification settings page. The category consists of at least three segments that are separated by dots. Each segment may only contain the following characters: [A-z0-9-_].]]></item>
+ <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.error.invalidSegments"><![CDATA[The following segments are invalid: {implode from=$invalidSegments key=segmentNumber item=segment}{if $segment !== ''}<code>{$segment}</code>{else}(empty){/if} (segment {#$segmentNumber + 1}){/implode}.]]></item>
+ <item name="wcf.acp.pip.objectType.com.woltlab.wcf.notification.objectType.category.error.tooFewSegments"><![CDATA[The category only contains {#$segmentCount} segment{if $segmentCount > 1}s{/if}.]]></item>
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.data.title"><![CDATA[Rebuild Data Worker Data]]></item>
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.niceValue"><![CDATA[Nice Value]]></item>
<item name="wcf.acp.pip.objectType.com.woltlab.wcf.rebuildData.niceValue.description"><![CDATA[The nice value is used to determine the order in which the rebuild data workers are shown and thus in which order they should be executed. Workers with lower nice value are shown first.]]></item>