Inheritance: extends Sulu\Bundle\AdminBundle\Admin\Admin
 /**
  * {@inheritdoc}
  */
 public function getNavigationItems(array $options = [])
 {
     if (!$this->securityChecker->hasPermission(SnippetAdmin::getDefaultSnippetsSecurityContext($options['webspace']), PermissionTypes::VIEW) || !$this->defaultEnabled) {
         return [];
     }
     $snippets = new ContentNavigationItem('content-navigation.webspace.snippets');
     $snippets->setId('tab-snippets');
     $snippets->setAction('snippets');
     $snippets->setPosition(25);
     $snippets->setComponent('webspace/settings/snippets@sulusnippet');
     return [$snippets];
 }
Beispiel #2
0
 /**
  * Remove default snippet for given key.
  *
  * @param string $key
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function deleteDefaultAction($key, Request $request)
 {
     $webspaceKey = $this->getRequestParameter($request, 'webspace', true);
     $this->get('sulu_security.security_checker')->checkPermission(new SecurityCondition(SnippetAdmin::getDefaultSnippetsSecurityContext($webspaceKey)), PermissionTypes::EDIT);
     $type = $this->get('sulu.content.structure_manager')->getStructure($key, Structure::TYPE_SNIPPET);
     $this->get('sulu_snippet.default_snippet.manager')->remove($webspaceKey, $key);
     return new JsonResponse(['template' => $type->getKey(), 'title' => $type->getLocalizedTitle($this->getUser()->getLocale()), 'defaultUuid' => null, 'defaultTitle' => null]);
 }