public function getButtons()
    {
        // if already assigned return the resutl
        if ($this->_buttons) {
            return $this->_buttons;
        }

        $buttons = [];
        
        // ngrest relation buttons
        foreach ($this->getConfig()->getRelations() as $rel) {
            $api = Yii::$app->adminmenu->getApiDetail($rel['apiEndpoint']);
            
            if (!$api) {
                throw new InvalidConfigException("The configured api relation '{$rel['apiEndpoint']}' does not exists in the menu elements. Maybe you have no permissions to access this API.");
            }
            
            $label = empty($rel['tabLabelAttribute']) ? "'{$rel['label']}'" : 'item.'.$rel['tabLabelAttribute'];
            
            $buttons[] = [
                'ngClick' => 'addAndswitchToTab(item.'.$this->getPrimaryKey().', \''.$api['route'].'\', \''.$rel['arrayIndex'].'\', '.$label.', \''.$rel['modelClass'].'\')',
                'icon' => 'chrome_reader_mode',
                'label' => $rel['label'],
            ];
        }
        
        if ($this->can(Auth::CAN_UPDATE)) {
            // get all activeWindows assign to the crud
            foreach ($this->getActiveWindows() as $hash => $config) {
                $buttons[] = [
                    'ngClick' => 'getActiveWindow(\''.$hash.'\', '.$this->getCompositionKeysForButtonActions('item').')',
                    'icon' => isset($config['objectConfig']['icon']) ? $config['objectConfig']['icon'] : $config['icon'],
                    'label' => isset($config['objectConfig']['label']) ? $config['objectConfig']['label'] : $config['label'],
                ];
            }
            // add active buttons.
            foreach ($this->config->getActiveButtons() as $btn) {
                $buttons[] = [
                    'ngClick' => "callActiveButton('{$btn['hash']}', ".$this->getCompositionKeysForButtonActions('item').", \$event)",
                    'icon' => $btn['icon'],
                    'label' => $btn['label'],
                ];
            }
        }
        
        // check if deletable is enabled
        if ($this->config->isDeletable() && $this->can(Auth::CAN_DELETE)) {
            $buttons[] = [
                'ngClick' => 'deleteItem('.$this->getCompositionKeysForButtonActions('item').')',
                'icon' => 'delete',
                'label' => '',
            ];
        }
        // do we have an edit button
        if (count($this->getFields('update')) > 0 && $this->can(Auth::CAN_UPDATE)) {
            $buttons[] = [
                'ngClick' => 'toggleUpdate('.$this->getCompositionKeysForButtonActions('item').')',
                'icon' => 'mode_edit',
                'label' => '',
            ];
        }
        
        $this->_buttons = $buttons;
        return $buttons;
    }