-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cda558
commit 4a04522
Showing
5 changed files
with
94 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
<?php | ||
|
||
/** | ||
* File containing the Blocks Component class | ||
* | ||
* @author Thiago Campos Viana <[email protected]> | ||
*/ | ||
|
||
namespace Tutei\BaseBundle\Classes\Components; | ||
|
||
use eZ\Publish\API\Repository\Values\Content\Query; | ||
|
@@ -38,7 +40,7 @@ public function render() | |
$query->criterion = new LogicalAnd( | ||
array( | ||
new ContentTypeIdentifier(array('block')), | ||
new ParentLocationId(array($locationId)) | ||
new ParentLocationId($locationId) | ||
) | ||
); | ||
|
||
|
@@ -55,26 +57,28 @@ public function render() | |
$blocks = array(); | ||
|
||
foreach ($list->searchHits as $block) { | ||
|
||
$parentId = $block->valueObject->versionInfo->contentInfo->mainLocationId; | ||
$blocks[$parentId]['content'] = $block; | ||
$query = new Query(); | ||
|
||
$query->criterion = new LogicalAnd( | ||
array( | ||
new ParentLocationId(array($parentId)) | ||
) | ||
); | ||
$query->sortClauses = array( | ||
new LocationPriority(Query::SORT_ASC) | ||
); | ||
|
||
$limit = null; | ||
$columns = $block->valueObject->fields['columns'][$this->controller->getLanguage()]->value; | ||
$rows = $block->valueObject->fields['rows'][$this->controller->getLanguage()]->value; | ||
$offset = $block->valueObject->fields['offset'][$this->controller->getLanguage()]->value; | ||
if ($rows > 0) { | ||
$query->limit = $rows * $columns; | ||
$limit = $rows * $columns; | ||
} | ||
$blockLocationId = $block->valueObject->versionInfo->contentInfo->mainLocationId; | ||
$blocks[$blockLocationId]['content'] = $block; | ||
|
||
if (!isset($block->valueObject->fields['source'][$this->controller->getLanguage()]->destinationContentId)) { | ||
|
||
$blocks[$parentId]['children'] = $searchService->findContent($query); | ||
$blocks[$blockLocationId]['children'] = SearchHelper::fetchChildren($this->controller, $blockLocationId, array(), $limit, $offset); | ||
} else { | ||
|
||
$sourceId = $block->valueObject->fields['source'][$this->controller->getLanguage()]->destinationContentId; | ||
$sourceObj = $repository->getContentService()->loadContent($sourceId); | ||
$parentId = $sourceObj->versionInfo->contentInfo->mainLocationId; | ||
$blocks[$blockLocationId]['children'] = SearchHelper::fetchChildren($this->controller, $parentId, array(), $limit, $offset); | ||
|
||
} | ||
} | ||
|
||
$siteaccess = $this->controller->getContainer()->get('ezpublish.siteaccess')->name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% set language = (siteaccess[ezpublish.siteaccess.name].language) %} | ||
|
||
<div class="content-view-line"> | ||
<div class="content-type-article media"> | ||
|
||
|
||
<div class="attribute-title media-heading"> | ||
<h2> | ||
<a href="{{ path( location ) }}" title="{{ location.contentInfo.name }}">{{ ez_render_field( content, 'title', { lang: language } ) }}</a> | ||
</h2> | ||
</div> | ||
|
||
{% if not ez_is_field_empty( content, 'image', { lang: language } ) %} | ||
|
||
<div class="attribute-image pull-left"> | ||
<a href="{{ path( location ) }}" title="{{ location.contentInfo.name }}"> | ||
|
||
{{ render_hinclude( | ||
controller( | ||
"ez_content:viewContent", | ||
{ | ||
"contentId": content.fields.image[language].destinationContentId, | ||
"viewType": "line", | ||
"params": { 'alias' : 'small' } | ||
} | ||
) | ||
) }}</a> | ||
</div> | ||
|
||
{% endif %} | ||
|
||
<div class="attribute-byline"> | ||
<span class="date"> | ||
<small>{{ location.contentInfo.publishedDate|localizeddate( 'short', 'short', app.request.locale ) }}</small> | ||
</span> | ||
{% if not ez_is_field_empty( content, 'author' ) %} | ||
<span class="author"><small> | ||
{{ ez_render_field( | ||
content, | ||
'author', | ||
{ | ||
'template': 'eZDemoBundle:fields:ezauthor_simple.html.twig' | ||
} | ||
) }}</small> | ||
</span> | ||
{% endif %} | ||
</div> | ||
|
||
{% if not ez_is_field_empty( content, 'intro', { lang: language } ) %} | ||
<div class="attribute-short media-body"> | ||
{{ ez_render_field( content, 'intro', { lang: language } ) }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters