*/ final class CKEditorField implements FieldInterface { use FieldTrait; public const OPTION_NUM_OF_ROWS = 'numOfRows'; public static function new(string $propertyName, ?string $label = null): self { return (new self()) ->setProperty($propertyName) ->setLabel($label) ->setTemplateName('crud/field/text_editor') ->setFormType(CKEditorType::class) ->addCssClass('field-text_editor') ->addCssFiles('bundles/easyadmin/form-type-text-editor.css') ->addJsFiles('bundles/easyadmin/form-type-text-editor.js') ->setCustomOption(self::OPTION_NUM_OF_ROWS, null); } public function setNumOfRows(int $rows): self { if ($rows < 1) { throw new \InvalidArgumentException(sprintf('The argument of the "%s()" method must be 1 or higher (%d given).', __METHOD__, $rows)); } $this->setCustomOption(self::OPTION_NUM_OF_ROWS, $rows); return $this; } }