Ceci est une ancienne révision du document !


Les Fields

Options

Communes

setFieldFqcn(string $fieldFqcn): self
setProperty(string $propertyName): self
setLabel($label): self //@param string|false|null $label
setValue($value): self
setFormattedValue($value): self
formatValue(?callable $callable): self
setVirtual(bool $isVirtual): self
setDisabled(bool $disabled = true): self
setRequired(bool $isRequired): self
setFormType(string $formTypeFqcn): self
setFormTypeOptions(array $options): self
setFormTypeOption(string $optionName, $optionValue): self //@param string $optionName You can use "dot" notation to set nested options (e.g. 'attr.class')
setFormTypeOptionIfNotSet(string $optionName, $optionValue): self //@param string $optionName You can use "dot" notation to set nested options (e.g. 'attr.class')
setSortable(bool $isSortable): self
setPermission(string $permission): self
setTextAlign(string $textAlign): self //@param string $textAlign It can be 'left', 'center' or 'right'
setHelp(string $help): self
addCssClass(string $cssClass): self
setCssClass(string $cssClass): self
setTranslationParameters(array $parameters): self
setTemplateName(string $name): self
setTemplatePath(string $path): self
addWebpackEncoreEntries(...$entryNamesOrAssets): self //@param string|Asset $entryNamesOrAssets
addCssFiles(...$pathsOrAssets): self //@param string|Asset $pathsOrAssets
addJsFiles(...$pathsOrAssets): self //@param string|Asset $pathsOrAssets
addHtmlContentsToHead(string ...$contents): self
addHtmlContentsToBody(string ...$contents): self
setCustomOption(string $optionName, $optionValue): self
setCustomOptions(array $options): self
hideOnDetail(): self
hideOnForm(): self
hideWhenCreating(): self
hideWhenUpdating(): self
hideOnIndex(): self
onlyOnDetail(): self
onlyOnForms(): self
onlyOnIndex(): self
onlyWhenCreating(): self
onlyWhenUpdating(): self
    /**
     * @param int|string $cols An integer with the number of columns that this field takes (e.g. 6),
     *                         or a string with responsive col CSS classes (e.g. 'col-6 col-sm-4 col-lg-3')
     */
setColumns($cols): self
    /**
     * Used to define the columns of fields when users don't define the
     * columns explicitly using the setColumns() method.
     * This should only be used if you create a custom EasyAdmin field,
     * not when configuring fields in your backend.
     *
     * @param int|string $cols
     *
     * @internal
     */
setDefaultColumns($cols): self
fillRow(bool $fillRow = true): self
getAsDto(): FieldDto

hideOnForm()

TextField

renderAsHtml

Pour rendre du texte au format HTML et non escaped, il faut modifier la CustomOption renderAsHtml à True

xxxxCrudController.php
public function configureFields(string $pageName): iterable
    {
        return [
            ...
            TextField::new('seriesfield')->setCustomOption('renderAsHtml', true), 
        ];
    }
Vous pourriez laisser un commentaire si vous étiez connecté.