Rendering a view which shows related content of tag.

@param \Symfony\Component\HttpFoundation\Request $request
@param \Netgen\TagsBundle\API\Repository\Values\Tags\Tag $tag

@return \Symfony\Component\HttpFoundation\Response
357631
public function relatedContentAction(Request $request, Tag $tag)
    {
        $this->denyAccessUnlessGranted('ez:tags:read');

        $currentPage = (int) $request->query->get('page');
        $configResolver = $this->getConfigResolver();

        $pager = $this->createPager(
            $this->adapter,
            $currentPage,
            $configResolver->getParameter('admin.related_content_limit', 'eztags'),
            $tag
        );

        return $this->render(
            '@NetgenTags/admin/tag/related_content.html.twig',
            [
                'tag' => $tag,
                'related_content' => $pager,
            ]
        );
    }
364474
public function detachTags(int $id, DetachRequest $request)
    {
        /** @var \Unite\Tags\HasTagsInterface $object */
        if(!$object = $this->repository->find($id)) {
            abort(404);
        }

        $data = $request->only('tag_names');

        $object->detachTags($data['tag_names']);

        \Cache::tags('response')->flush();

        return $this->successJsonResponse();
    }
1022570
public function edit(TagRequest $request, Tag $tag)
    {
        return $this->response->title(trans('app.edit') . ' ' . trans('blog::tag.name'))
            ->view('blog::tag.edit', true)
            ->data(compact('tag'))
            ->output();
    }
860874
public function indexAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse('AnimeDbCatalogBundle:Item');
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        // current page for paging
        $page = $request->get('page', 1);
        $current_page = $page > 1 ? $page : 1;

        /* @var $rep ItemRepository */
        $rep = $this->getDoctrine()->getRepository('AnimeDbCatalogBundle:Item');
        /* @var $controls ListControls */
        $controls = $this->get('anime_db.item.list_controls');

        $pagination = null;
        // show not all items
        if ($limit = $controls->getLimit($request->query->all())) {
            $that = $this;
            $query = $request->query->all();
            unset($query['page']);
            $pagination = $this->get('anime_db.pagination')
                ->create(ceil($rep->count() / $limit), $current_page)
                ->setPageLink(function ($page) use ($that, $query) {
                    return $that->generateUrl('home', array_merge($query, ['page' => $page]));
                })
                ->setFirstPageLink($this->generateUrl('home', $query))
                ->getView();
        }

        // get items
        $items = $rep->getList($limit, ($current_page - 1) * $limit);

        return $this->render('AnimeDbCatalogBundle:Home:index.html.twig', [
            'items' => $items,
            'pagination' => $pagination,
            'widget_top' => self::WIDGET_PALCE_TOP,
            'widget_bottom' => self::WIDGET_PALCE_BOTTOM,
        ], $response);
    }
1339457
public function showSearchResultsAction(Request $request)
    {
        $response = new Response();
        $searchText = '';
        $searchCount = 0;

        // Creating a form using Symfony's form component
        $simpleSearch = new SimpleSearch();
        $form = $this->createForm($this->get('ezdemo.form.type.simple_search'), $simpleSearch);
        $form->handleRequest($request);

        $pager = null;

        if ($form->isValid()) {
            /** @var SearchHelper $searchHelper */
            $searchHelper = $this->get('ezdemo.search_helper');

            if (!empty($simpleSearch->searchText)) {
                $searchText = $simpleSearch->searchText;

                $pager = $searchHelper->searchForPaginatedContent(
                    $searchText,
                    $request->get('page', 1),
                    $this->getConfigResolver()->getParameter('languages')
                );

                $searchCount = $pager->getNbResults();
            }
        }

        return $this->render(
            'eZDemoBundle:search:search.html.twig',
            array(
                'searchText' => $searchText,
                'searchCount' => $searchCount,
                'pagerSearch' => $pager,
                'form' => $form->createView(),
            ),
            $response
        );
    }
8100
public function update(Tag $tag, FormRequest $request)
    {
        $this->repository->update($request->id, $request->all());

        return $this->redirect($request, $tag);
    }
604948
public function getTagByUrl($request)
    {
        $this->resort();
        foreach ($this->requests as $url=>$tag) {
            if (0 === strrpos($request, $url)) return $tag;
        }
        return null;
    }
856787
public function ajaxTagAction(Request $request)
    {
        // if ($request->isXmlHttpRequest()) {
            $em = $this->getDoctrine()->getManager();
            if ($request->getMethod() == "GET") {
                $tags = $this->get('okto_media_tag')->findAll();
                $json = [];
                foreach ($tags as $tag) {
                    $json[] = $tag->getText();
                }
                return new Response(json_encode($json));
            }
        // }
        return $this->redirect('oktothek_tag_index');
    }
1209556
protected function process(FormRequest $request, Tag $tag)
    {
        // Prepare required input fields
        $data = $request->validated();

        // Save tag
        $tag->fill($data)->save();

        return intend([
            'url' => route('adminarea.tags.index'),
            'with' => ['success' => trans('cortex/foundation::messages.resource_saved', ['resource' => trans('cortex/tags::common.tag'), 'identifier' => $tag->name])],
        ]);
    }
1232207
public function getRelatedContent($tagPath, Request $request)
    {
        $offset = $request->query->has('offset') ? (int) $request->query->get('offset') : 0;
        $limit = $request->query->has('limit') ? (int) $request->query->get('limit') : 25;

        $tagId = $this->extractTagIdFromPath($tagPath);
        $relatedContent = $this->tagsService->getRelatedContent(
            $this->tagsService->loadTag($tagId),
            $offset >= 0 ? $offset : 0,
            $limit >= 0 ? $limit : 25
        );

        $restContent = [];
        foreach ($relatedContent as $contentInfo) {
            $restContent[] = new BaseValues\RestContent($contentInfo);
        }

        return new Values\CachedValue(
            new Values\ContentList(
                $restContent,
                $request->getPathInfo()
            ),
            ['tagId' => $tagId]
        );
    }
1089263
public function listAction(Request $request): Response
    {
        $page = $request->query->get('page', 1);

        $pagerfanta = new Pagerfanta(
            new BookmarkAdapter($this->bookmarkService, $this->datasetFactory)
        );

        $pagerfanta->setMaxPerPage($this->defaultPaginationLimit);
        $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages()));

        $editForm = $this->formFactory->contentEdit(
            new ContentEditData()
        );

        $removeBookmarkForm = $this->formFactory->removeBookmark(
            new BookmarkRemoveData($this->getChoices($pagerfanta->getCurrentPageResults()))
        );

        return $this->render(
            '@ezdesign/admin/bookmark/list.html.twig',
            $viewParameters = [
                'pager' => $pagerfanta,
                'form_edit' => $editForm->createView(),
                'form_remove' => $removeBookmarkForm->createView(),
            ]
        );
    }
66184
public function checkTag(Tag $tag)
	{
		if (isset($tag->template) && !($tag->template instanceof UnsafeTemplate))
		{
			$template = (string) $tag->template;
			$this->checkTemplate($template, $tag);
		}
	}
1001396
public function showAction(Request $request)
    {
        $schemaAlias = $request->attributes->get('schema');

        $this->isGrantedOr403($schemaAlias);

        $settings = $this->getSettingsManager()->load($schemaAlias);

        $view = $this
            ->view()
            ->setData($settings)
        ;

        return $this->handleView($view);
    }
996424
public function viewRelatedItems(Request $request, Content $content, string $fieldDefinitionIdentifier, string $template): Response
    {
        return $this->render(
            $template,
            [
                'content' => $content,
                'location' => $content->mainLocation,
                'field_identifier' => $fieldDefinitionIdentifier,
                'related_items' => $this->locationResolver->loadRelations($content->mainLocation, $fieldDefinitionIdentifier),
                'view_type' => $request->attributes->get('viewType') ?? 'line',
            ]
        );
    }
954374
public function showAction(Request $request, $id = 1)
    {

        $resource = $this->findOr404('find', array($id));

        $this->dispatch(Actions::SHOW, $resource);

        return $this->render($this->getFromConfig($request, 'template', true), array(
            $this->name => $resource
        ));
    }
1295364
public function getElementHtml(Request $request)
    {
        $properties = Model::whereIn('id', $request->get('property_id'))->get();

        $tmpString = str_random();
        $view = view('avored-ecommerce::property.get-element')
                        ->with('properties', $properties)
                        ->with('tmpString', $tmpString);

        $json = new JsonResponse(['success' => true, 'content' => $view->render()]);

        return $json;
    }
942772
public function destroy(Tag $tag, Request $request)
	{
		$this->deleteEntry($tag, $request);

        return redirect_to_resource();
	}