Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/Twig/TaxonomyListExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ public function twigTaxonomyList($name = false, $params = false)
$options[$slug]['weight'] = $item['weight'];
$options[$slug]['weightclass'] = $item['weightclass'];
}
if (array_key_exists('posts', $item)) {
$options[$slug]['posts'] = array();
foreach( explode( ";;;", $item['posts'] ) as $post ){
$post_attrs = explode( ":::", $post );
array_push( $options[$slug]['posts'], array(
'type' => $post_attrs[0],
'id' => $post_attrs[1],
) );
}
}
}
return $options;
}
Expand Down Expand Up @@ -129,7 +139,7 @@ protected function getFullTaxonomy($name = null, $taxonomy = null, $params = nul
if (!$contenttype) {
// the normal query
$query = sprintf(
"SELECT COUNT(name) as count, slug, name
"SELECT COUNT(name) as count, slug, name, GROUP_CONCAT( contenttype || ':::' || content_id, ';;;' ) as posts
FROM %s
WHERE taxonomytype IN ('%s')
GROUP BY name, slug, sortorder
Expand All @@ -143,7 +153,7 @@ protected function getFullTaxonomy($name = null, $taxonomy = null, $params = nul
$contenttype_table = $prefix . $contenttype;
// the normal query with only published items
$query = sprintf(
"SELECT COUNT(name) as count, slug, name
"SELECT COUNT(name) as count, slug, name, GROUP_CONCAT( contenttype || ':::' || content_id, ';;;' ) as posts
FROM %s
WHERE taxonomytype = '%s'
AND contenttype = '%s'
Expand Down