toolbarButtons = []; } return $this; } /** * @param array $buttonsToDisable */ public function disableToolbarButtons(array $buttonsToDisable = []): static { $this->toolbarButtons = array_values(array_filter( $this->getToolbarButtons(), static fn ($button) => ! in_array($button, $buttonsToDisable), )); return $this; } /** * @param array $buttonsToEnable */ public function enableToolbarButtons(array $buttonsToEnable = []): static { $this->toolbarButtons = [ ...$this->getToolbarButtons(), ...$buttonsToEnable, ]; return $this; } /** * @param array | Closure $buttons */ public function toolbarButtons(array | Closure $buttons = []): static { $this->toolbarButtons = $buttons; return $this; } /** * @return array */ public function getToolbarButtons(): array { return $this->evaluate($this->toolbarButtons); } /** * @param string | array $button */ public function hasToolbarButton(string | array $button): bool { if (is_array($button)) { $buttons = $button; return (bool) count(array_intersect($buttons, $this->getToolbarButtons())); } return in_array($button, $this->getToolbarButtons()); } }