use wcf\system\form\builder\button\wysiwyg\WysiwygPreviewFormButton;
use wcf\system\form\builder\container\FormContainer;
use wcf\system\form\builder\container\TabFormContainer;
+use wcf\system\form\builder\field\IMaximumLengthFormField;
+use wcf\system\form\builder\field\IMinimumLengthFormField;
+use wcf\system\form\builder\field\TMaximumLengthFormField;
+use wcf\system\form\builder\field\TMinimumLengthFormField;
use wcf\system\form\builder\field\wysiwyg\WysiwygAttachmentFormField;
use wcf\system\form\builder\field\wysiwyg\WysiwygFormField;
use wcf\system\form\builder\IFormNode;
* @package WoltLabSuite\Core\System\Form\Builder\Container\Wysiwyg
* @since 5.2
*/
-class WysiwygFormContainer extends FormContainer {
+class WysiwygFormContainer extends FormContainer implements IMaximumLengthFormField, IMinimumLengthFormField {
+ use TMaximumLengthFormField;
+ use TMinimumLengthFormField;
use TWysiwygFormNode;
/**
*/
protected $quoteData;
+ /**
+ * `true` if the wysiwyg field has to be filled out and `false` otherwise
+ * @var bool
+ */
+ protected $required = false;
+
/**
* settings form container
* @var FormContainer
return parent::id($id);
}
+ /**
+ * Returns `true` if the wsyiwyg field has to be filled out and returns `false` otherwise.
+ * By default, the wsyiwyg field does not have to be filled out.
+ *
+ * @return bool
+ */
+ public function isRequired() {
+ return $this->required;
+ }
+
/**
* Sets the message object type used by the wysiwyg form field.
*
$this->wysiwygField = WysiwygFormField::create($this->wysiwygId)
->objectType($this->messageObjectType)
+ ->minimumLength($this->getMinimumLength())
+ ->maximumLength($this->getMaximumLength())
+ ->required($this->isRequired())
->supportAttachments($this->attachmentData !== null)
->supportMentions($this->supportMentions)
->supportQuotes($this->supportQuotes);
return $this;
}
+ /**
+ * Sets whether it is required to fill out the wysiwyg field and returns this container.
+ *
+ * @param bool $required determines if field has to be filled out
+ * @return static this container
+ */
+ public function required($required = true) {
+ $this->required = $required;
+
+ return $this;
+ }
+
/**
* Sets if mentions are supported by the editor field and returns this form container.
*