2121use wcf \system \form \builder \TWysiwygFormNode ;
2222use wcf \system \Regex ;
2323
24+ use const MODULE_SMILEY ;
25+
2426/**
2527 * i18n implementation of WysiwygFormContainer
2628 *
@@ -96,7 +98,7 @@ public static function create($id): static
9698 {
9799 // the actual id is used for the form field containing the text
98100 return parent ::create ($ id . 'Container ' )
99- ->addClass ('mcWysiwygContainer ' );
101+ ->addClass ('mcWysiwygContainer ' );
100102 }
101103
102104 /**
@@ -136,24 +138,24 @@ public function addSettingsNodes(array $settingsNodes): static
136138 *
137139 * By default, no attachment data is set.
138140 *
139- * @throws \ BadMethodCallException if the attachment form field has already been initialized
141+ * @throws BadMethodCallException if the attachment form field has already been initialized
140142 */
141143 public function attachmentData (?string $ objectType = null , int $ parentObjectID = 0 ): static
142144 {
143145 if (isset ($ this ->attachmentField )) {
144- throw new \ BadMethodCallException ("The attachment form field ' {$ this ->getId ()}' has already been initialized. Use the atatchment form field directly to manipulate attachment data. " );
146+ throw new BadMethodCallException ("The attachment form field ' {$ this ->getId ()}' has already been initialized. Use the atatchment form field directly to manipulate attachment data. " );
145147 }
146148
147149 if ($ objectType === null ) {
148- unset( $ this ->attachmentData ) ;
150+ $ this ->attachmentData = null ;
149151 } else {
150152 if (
151153 ObjectTypeCache::getInstance ()->getObjectTypeByName (
152154 'com.woltlab.wcf.attachment.objectType ' ,
153155 $ objectType
154156 ) === null
155157 ) {
156- throw new \ InvalidArgumentException ("Unknown attachment object type ' {$ objectType }' for container ' {$ this ->getId ()}'. " );
158+ throw new InvalidArgumentException ("Unknown attachment object type ' {$ objectType }' for container ' {$ this ->getId ()}'. " );
157159 }
158160
159161 $ this ->attachmentData = [
@@ -170,12 +172,12 @@ public function attachmentData(?string $objectType = null, int $parentObjectID =
170172 *
171173 * By default, the preview button is shown.
172174 *
173- * @throws \ BadMethodCallException if the form field container has already been populated yet
175+ * @throws BadMethodCallException if the form field container has already been populated yet
174176 */
175177 public function enablePreviewButton (bool $ enablePreviewButton = true ): static
176178 {
177179 if ($ this ->isPopulated ) {
178- throw new \ BadMethodCallException (
180+ throw new BadMethodCallException (
179181 "Enabling and disabling the preview button is only possible before the form has been built for container ' {$ this ->getId ()}'. "
180182 );
181183 }
@@ -188,12 +190,12 @@ public function enablePreviewButton(bool $enablePreviewButton = true): static
188190 /**
189191 * Returns the form field handling attachments.
190192 *
191- * @throws \ BadMethodCallException if the form field container has not been populated yet/form has not been built yet
193+ * @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
192194 */
193195 public function getAttachmentField (): MCWysiwygAttachmentFormField
194196 {
195197 if (!isset ($ this ->attachmentField )) {
196- throw new \ BadMethodCallException (
198+ throw new BadMethodCallException (
197199 "Wysiwyg form field can only be requested after the form has been built for container ' {$ this ->getId ()}'. "
198200 );
199201 }
@@ -223,12 +225,12 @@ public function getPreselect(): string
223225 /**
224226 * Returns the wysiwyg form container with all poll-related fields.
225227 *
226- * @throws \ BadMethodCallException if the form field container has not been populated yet/form has not been built yet
228+ * @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
227229 */
228230 public function getPollContainer (): WysiwygPollFormContainer
229231 {
230232 if (!isset ($ this ->pollContainer )) {
231- throw new \ BadMethodCallException (
233+ throw new BadMethodCallException (
232234 "Wysiwyg form field can only be requested after the form has been built for container ' {$ this ->getId ()}'. "
233235 );
234236 }
@@ -239,12 +241,12 @@ public function getPollContainer(): WysiwygPollFormContainer
239241 /**
240242 * Returns the form container for all settings-related fields.
241243 *
242- * @throws \ BadMethodCallException if the form field container has not been populated yet/form has not been built yet
244+ * @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
243245 */
244246 public function getSettingsContainer (): FormContainer
245247 {
246248 if (!isset ($ this ->settingsContainer )) {
247- throw new \ BadMethodCallException (
249+ throw new BadMethodCallException (
248250 "Wysiwyg form field can only be requested after the form has been built for container ' {$ this ->getId ()}'. "
249251 );
250252 }
@@ -255,12 +257,12 @@ public function getSettingsContainer(): FormContainer
255257 /**
256258 * Returns the form container for smiley categories.
257259 *
258- * @throws \ BadMethodCallException if the form field container has not been populated yet/form has not been built yet
260+ * @throws BadMethodCallException if the form field container has not been populated yet/form has not been built yet
259261 */
260262 public function getSmiliesContainer (): WysiwygSmileyFormContainer
261263 {
262264 if (!isset ($ this ->smiliesContainer )) {
263- throw new \ BadMethodCallException (
265+ throw new BadMethodCallException (
264266 "Smilies form field container can only be requested after the form has been built for container ' {$ this ->getId ()}'. "
265267 );
266268 }
@@ -308,7 +310,7 @@ public function markAsRequired(): bool
308310 /**
309311 * Sets the message object type used by the wysiwyg form field.
310312 *
311- * @throws \ InvalidArgumentException if the given string is no message object type
313+ * @throws InvalidArgumentException if the given string is no message object type
312314 */
313315 public function messageObjectType (string $ messageObjectType ): static
314316 {
@@ -318,7 +320,7 @@ public function messageObjectType(string $messageObjectType): static
318320 $ messageObjectType
319321 ) === null
320322 ) {
321- throw new \ InvalidArgumentException (
323+ throw new InvalidArgumentException (
322324 "Unknown message object type ' {$ messageObjectType }' for container ' {$ this ->getId ()}'. "
323325 );
324326 }
@@ -349,12 +351,12 @@ public function updatedObject(array $data, IStorableObject $object, $loadValues
349351 *
350352 * By default, no poll object type is set, thus the poll form field container is not available.
351353 *
352- * @throws \ InvalidArgumentException if the given string is no poll object type
354+ * @throws InvalidArgumentException if the given string is no poll object type
353355 */
354356 public function pollObjectType (string $ pollObjectType ): static
355357 {
356358 if (ObjectTypeCache::getInstance ()->getObjectTypeByName ('com.woltlab.wcf.poll ' , $ pollObjectType ) === null ) {
357- throw new \ InvalidArgumentException (
359+ throw new InvalidArgumentException (
358360 "Unknown poll object type ' {$ pollObjectType }' for container ' {$ this ->getId ()}'. "
359361 );
360362 }
@@ -474,7 +476,7 @@ public function supportQuotes(bool $supportQuotes = true): static
474476 */
475477 public function supportSmilies (bool $ supportSmilies = true ): static
476478 {
477- if (!\ MODULE_SMILEY ) {
479+ if (!MODULE_SMILEY ) {
478480 $ supportSmilies = false ;
479481 }
480482
@@ -495,7 +497,7 @@ public function supportSmilies(bool $supportSmilies = true): static
495497 public function getWysiwygField (): MCI18nWysiwygFormField
496498 {
497499 if (!isset ($ this ->wysiwygField )) {
498- throw new \ BadMethodCallException (
500+ throw new BadMethodCallException (
499501 "Wysiwyg form field can only be requested after the form has been built for container ' {$ this ->getId ()}'. "
500502 );
501503 }
0 commit comments