I have an HSCT field in a view and wanted the individual terms spit out separately so I can theme them in different table cells. Specifically I have two hierarchical content taxonomy terms, "City" --> "Neighborhood". I would like the two to be separate instead of what Views currently gives me:

$fields['neighborhood']->content

Viewing the output of this yields: <div class="field-item field-item-0">Boston</div><div class="field-item field-item-1">Revere Beach</div>

Whereas I need the two terms separately like: $fields['neighborhood'][0]->content which would give me just the term 'Boston', and another [1] giving 'Revere Beach'.

Is this possible somehow?

Comments

druplicate’s picture

Status: Fixed » Active

I suppose I could use a PHP snippet to parse the string and separate the variables but that shouldn't be necessary.

druplicate’s picture

Status: Active » Fixed
druplicate’s picture

wim leers’s picture

Assigned: Unassigned » wim leers
Status: Active » Fixed

Override theme_hs_content_taxonomy_formatter_hierarchical()! :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

druplicate’s picture

Unfortunately that's beyond my programming ability at the moment, so I just used CSS to reposition the two elements since they have separate classes.

.field-item.field-item-0 {
  position:relative;
  top:2px;

}

.field-item.field-item-1 {
  position:relative;
  top:17px;

}

These two elements are vertically adjacent cells in a table.

And then played with the line height to adjust the cell height in the table because with the separate divs it expanded the cell height.

Totally cheating, but it works!