*/ protected array $extraItemActions = []; /** * @var array | null */ protected ?array $cachedExtraItemActions = null; /** * @param array $actions */ public function extraItemActions(array $actions): static { $this->extraItemActions = [ ...$this->extraItemActions, ...$actions, ]; return $this; } /** * @return array */ public function getExtraItemActions(): array { return $this->cachedExtraItemActions ?? $this->cacheExtraItemActions(); } /** * @return array */ public function cacheExtraItemActions(): array { $this->cachedExtraItemActions = []; foreach ($this->extraItemActions as $extraItemAction) { foreach (Arr::wrap($this->evaluate($extraItemAction)) as $action) { $this->cachedExtraItemActions[$action->getName()] = $this->prepareAction( $action ->defaultColor('gray') ->defaultSize(ActionSize::Small) ->defaultView(Action::ICON_BUTTON_VIEW), ); } } return $this->cachedExtraItemActions; } }