/** * check the possible node view modes and set with the given one. * * @param string $targetViewMode */ private function setViewMode($targetViewMode) { $view_modes = array_keys($this->entity_manager->getViewModeOptions('node')); if (in_array($targetViewMode, $view_modes)) { $this->configuration['block_node_view_mode'] = $targetViewMode; return; } // else update view_modes $this->view_modes = $this->entity_manager->getViewModeOptions('node'); $this->configuration['block_node_view_mode'] = $this->default_view_mode; }