Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | namespace Apie\HtmlBuilders\ResourceActions; |
| 3 | |
| 4 | use Apie\Common\ActionDefinitions\ActionDefinitionInterface; |
| 5 | use Apie\Core\Context\ApieContext; |
| 6 | use Apie\Core\Entities\EntityInterface; |
| 7 | use Apie\HtmlBuilders\Configuration\CurrentConfiguration; |
| 8 | use Apie\HtmlBuilders\Enums\ActionDefinitionVariant; |
| 9 | use ReflectionClass; |
| 10 | |
| 11 | interface SingleResourceActionInterface |
| 12 | { |
| 13 | /** |
| 14 | * @template T of EntityInterface |
| 15 | * @param T $entity |
| 16 | * @param ReflectionClass<T> $entityClass |
| 17 | */ |
| 18 | public static function createForEntity(EntityInterface $entity, ReflectionClass $entityClass, ActionDefinitionInterface $actionDefinition): ?self; |
| 19 | |
| 20 | /** |
| 21 | * Returns name/label of resource action. |
| 22 | */ |
| 23 | public function getName(): string; |
| 24 | |
| 25 | /** |
| 26 | * Returns url of resource action (form). |
| 27 | */ |
| 28 | public function getUrl(CurrentConfiguration $currentConfiguration): string; |
| 29 | |
| 30 | /** |
| 31 | * Used for resource action buttons. For example a remove action is 'danger'. A create resource action is 'primary' |
| 32 | */ |
| 33 | public function getVariant(): ActionDefinitionVariant; |
| 34 | |
| 35 | /** |
| 36 | * Can be used by the layout to render small pages/form in a sidebar instead. |
| 37 | */ |
| 38 | public function isSmallPage(?ApieContext $apieContext = null): bool; |
| 39 | } |