Skip to content

Instantly share code, notes, and snippets.

View MarioBlazek's full-sized avatar
🎯
Focusing

Mario Blazek MarioBlazek

🎯
Focusing
View GitHub Profile
<?php
namespace AppBundle\Queries;
use eZ\Publish\Core\QueryType\QueryType;
use Netgen\EzPlatformSiteApi\API\LoadService;
use Netgen\TagsBundle\API\Repository\Values\Content\Query\Criterion\TagId;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
app.queries.lastest_related_recipies:
class: AppBundle\Queries\LatestRelatedRecipes
arguments:
- '@netgen.ezplatform_site.load_service'
tags:
- { name: ezpublish.query_type }
<?php
namespace AppBundle\Queries;
use eZ\Publish\Core\QueryType\OptionsResolverBasedQueryType;
use Netgen\EzPlatformSiteApi\API\LoadService;
use Netgen\TagsBundle\API\Repository\Values\Content\Query\Criterion\TagId;
use Netgen\TagsBundle\API\Repository\Values\Tags\Tag;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\API\Repository\Values\Content\Query\SortClause;
{% if recipies is defined and recipies is not empty %}
<h2 class="section-title section-title-centered title">Latest recipies</h2>
{% for recipie in recipies %}
{{ render(
controller(
'ng_content:viewAction', {
'content': recipie.content,
'location': recipie,
'viewType': 'standard',
ng_recipe:
template: "@ezdesign/content/full/ng_recipe.html.twig"
controller: "ez_query:contentQueryAction"
match:
Identifier\ContentType: ng_recipe
params:
query:
query_type: 'LatestRelatedRecipies'
parameters:
recipe_content_id: "@=content.id"
{% if recipes is defined and recipes.totalCount > 0 %}
<h2 class="section-title section-title-centered title">Latest recipes</h2>
{% for recipe in recipes.searchHits %}
{{ render(
controller(
'ez_content:viewAction', {
'contentId': recipe.id,
'locationId': recipe.contentInfo.mainLocationId,
'viewType': 'standard',
ng_recipe:
template: "@ezdesign/content/full/ng_recipe.html.twig"
match:
Identifier\ContentType: ng_recipe
queries:
latest_recipes:
query_type: SiteAPI:Content/Relations/TagFields
max_per_page: 4
page: '@=queryParam("page", 1)'
parameters:
{% set recipes = ng_query( 'latest_recipes' ) %}
{% if recipes.getNbResults > 0 %}
<h2 class="section-title section-title-centered title">Latest recipes</h2>
{% for recipe in recipes %}
{{ render(
controller(
'ng_content:viewAction', {
'content': recipe,
@MarioBlazek
MarioBlazek / php_policy.php
Last active May 29, 2019 09:15
php_policy.php
<?php
declare(strict_types=1);
namespace Netgen\InformationCollection\PolicyProvider;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigBuilderInterface;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface;
class InformationCollectionPolicyProvider implements PolicyProviderInterface
@MarioBlazek
MarioBlazek / php_policy_array.php
Created May 29, 2019 09:16
php_policy_array.php
$configBuilder->addConfig([
'infocollector' => [
'read' => [],
'delete' => [],
'anonymize' => [],
],
]);