|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace EasyCorp\Bundle\EasyAdminBundle\Contracts\Field; |
| 6 | + |
| 7 | +use EasyCorp\Bundle\EasyAdminBundle\Config\Asset; |
| 8 | +use Symfony\Contracts\Translation\TranslatableInterface; |
| 9 | + |
| 10 | +interface FieldTraitAwareInterface extends FieldInterface |
| 11 | +{ |
| 12 | + public function setFieldFqcn(string $fieldFqcn): self; |
| 13 | + |
| 14 | + public function setProperty(string $propertyName): self; |
| 15 | + |
| 16 | + public function setLabel(TranslatableInterface|string|false|null $label): self; |
| 17 | + |
| 18 | + public function setValue($value): self; |
| 19 | + |
| 20 | + public function setFormattedValue($value): self; |
| 21 | + |
| 22 | + public function formatValue(?callable $callable): self; |
| 23 | + |
| 24 | + public function setVirtual(bool $isVirtual): self; |
| 25 | + |
| 26 | + public function setDisabled(bool $disabled = true): self; |
| 27 | + |
| 28 | + public function setRequired(bool $isRequired): self; |
| 29 | + |
| 30 | + public function setEmptyData($emptyData = null): self; |
| 31 | + |
| 32 | + public function setFormType(string $formTypeFqcn): self; |
| 33 | + |
| 34 | + public function setFormTypeOptions(array $options): self; |
| 35 | + |
| 36 | + /** |
| 37 | + * @param string $optionName You can use "dot" notation to set nested options (e.g. 'attr.class') |
| 38 | + */ |
| 39 | + public function setFormTypeOption( |
| 40 | + string $optionName, |
| 41 | + $optionValue, |
| 42 | + ): self; |
| 43 | + |
| 44 | + /** |
| 45 | + * @param string $optionName You can use "dot" notation to set nested options (e.g. 'attr.class') |
| 46 | + */ |
| 47 | + public function setFormTypeOptionIfNotSet( |
| 48 | + string $optionName, |
| 49 | + $optionValue, |
| 50 | + ): self; |
| 51 | + |
| 52 | + public function setSortable(bool $isSortable): self; |
| 53 | + |
| 54 | + public function setPermission(string $permission): self; |
| 55 | + |
| 56 | + /** |
| 57 | + * @param string $textAlign It can be 'left', 'center' or 'right' |
| 58 | + */ |
| 59 | + public function setTextAlign(string $textAlign): self; |
| 60 | + |
| 61 | + public function setHelp(TranslatableInterface|string $help): self; |
| 62 | + |
| 63 | + public function addCssClass(string $cssClass): self; |
| 64 | + |
| 65 | + public function setCssClass(string $cssClass): self; |
| 66 | + |
| 67 | + public function setTranslationParameters(array $parameters): self; |
| 68 | + |
| 69 | + public function setTemplateName(string $name): self; |
| 70 | + |
| 71 | + public function setTemplatePath(string $path): self; |
| 72 | + |
| 73 | + public function addFormTheme(string ...$formThemePaths): self; |
| 74 | + |
| 75 | + public function addWebpackEncoreEntries(Asset|string ...$entryNamesOrAssets, |
| 76 | + ): self; |
| 77 | + |
| 78 | + public function addCssFiles(Asset|string ...$pathsOrAssets): self; |
| 79 | + |
| 80 | + public function addJsFiles(Asset|string ...$pathsOrAssets): self; |
| 81 | + |
| 82 | + public function addHtmlContentsToHead(string ...$contents): self; |
| 83 | + |
| 84 | + public function addHtmlContentsToBody(string ...$contents): self; |
| 85 | + |
| 86 | + public function setCustomOption( |
| 87 | + string $optionName, |
| 88 | + $optionValue, |
| 89 | + ): self; |
| 90 | + |
| 91 | + public function setCustomOptions(array $options): self; |
| 92 | + |
| 93 | + public function hideOnDetail(): self; |
| 94 | + |
| 95 | + public function hideOnForm(): self; |
| 96 | + |
| 97 | + public function hideWhenCreating(): self; |
| 98 | + |
| 99 | + public function hideWhenUpdating(): self; |
| 100 | + |
| 101 | + public function hideOnIndex(): self; |
| 102 | + |
| 103 | + public function onlyOnDetail(): self; |
| 104 | + |
| 105 | + public function onlyOnForms(): self; |
| 106 | + |
| 107 | + public function onlyOnIndex(): self; |
| 108 | + |
| 109 | + public function onlyWhenCreating(): self; |
| 110 | + |
| 111 | + public function onlyWhenUpdating(): self; |
| 112 | + |
| 113 | + /** |
| 114 | + * @param int|string $cols An integer with the number of columns that this field takes (e.g. 6), |
| 115 | + * or a string with responsive col CSS classes (e.g. 'col-6 col-sm-4 col-lg-3') |
| 116 | + */ |
| 117 | + public function setColumns(int|string $cols): self; |
| 118 | + |
| 119 | + /** |
| 120 | + * Used to define the columns of fields when users don't define the |
| 121 | + * columns explicitly using the setColumns() method. |
| 122 | + * This should only be used if you create a custom EasyAdmin field, |
| 123 | + * not when configuring fields in your backend. |
| 124 | + * |
| 125 | + * @internal |
| 126 | + */ |
| 127 | + public function setDefaultColumns(int|string $cols): self; |
| 128 | + |
| 129 | + public function setIcon(?string $iconCssClass, string $invokingMethod = 'FormField::setIcon()'): self; |
| 130 | +} |
0 commit comments