Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
prog:symfony:extensions:easyadmin:fields [15/10/2022 15:46] thierry [TextField] |
prog:symfony:extensions:easyadmin:fields [24/10/2022 19:08] (Version actuelle) thierry [hideOnForm()] |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Les Fields ====== | ====== Les Fields ====== | ||
- | ===== TextField ===== | + | ===== Options ===== |
- | ==== renderAsHtml ==== | + | ==== Communes ==== |
+ | |||
+ | <code> | ||
+ | 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 | ||
+ | </code> | ||
+ | === hideOnForm === | ||
+ | Cacher le champ du formulaire de modification/création | ||
+ | <code php> | ||
+ | public function configureFields(string $pageName): iterable | ||
+ | { | ||
+ | return [ | ||
+ | TextField::new('contact','Nom + Prénom')->hideOnForm(), | ||
+ | ]; | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== TextField ==== | ||
+ | |||
+ | === renderAsHtml === | ||
Pour rendre du texte au format HTML et non escaped, il faut modifier la ''CustomOption'' ''renderAsHtml'' à ''True'' | Pour rendre du texte au format HTML et non escaped, il faut modifier la ''CustomOption'' ''renderAsHtml'' à ''True'' | ||
<code php xxxxCrudController.php> | <code php xxxxCrudController.php> |