Skip to content

Commit

Permalink
PCC-83: Fixes the tags mapping and listing.
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvir249 committed Jun 4, 2024
1 parent faed4df commit cd09ece
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/Plugin/views/field/PccTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,32 +70,39 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) {
public function preRender(&$values) {
$this->items = [];
$tags = [];
foreach ($values as $result) {
foreach ($values as $row => $result) {
$tags = $this->getValue($result);
if ($tags) {
foreach ($tags as $key => $tag) {
$this->items[$key]['tags'] = $tag;
}
if (!empty($tags)) {
$this->items[$row]['tags'] = $tags;
}
}
}

/**
* {@inheritdoc}
*/
public function getItems(ResultRow $values) {
if (!empty($this->items)) {
return $this->items;
}

return [];
public function render_item($count, $item) {
return $item['tags'];
}

/**
* {@inheritdoc}
*/
public function render_item($count, $item) {
return $item['tags'];
public function getItems(ResultRow $values) {
$field = $this->getValue($values);
if (!$field) {
return [];
}
$items = [];
foreach ($this->items as $row => $item) {
if (!array_diff($field, $item['tags'])) {
foreach ($item['tags'] as $key => $tag) {
$items[$row][$key]['tags'] = $tag;
}
return $items[$row];
}
}
return [];
}

/**
Expand Down

0 comments on commit cd09ece

Please sign in to comment.