Currently, the output of the views display plugin into popups or tooltips has hard-coded html:

        $descriptions = array();
        foreach ($record as $k => $v) {
          foreach ($handlers as $hid => $handler) {
            $rendered_record[$handler->field_alias] = $handler->advanced_render($v);
          }
          $item = '';
          if ($data_source['name_field']) {
            $name_field = $fields[$data_source['name_field']]['field_alias'];
            $item .= "<h2 class='point-title'>". $rendered_record[$name_field] ."</h2>";
          } 
          if ($data_source['description_field']) {
            $description_field = $fields[$data_source['description_field']]['field_alias'];
            $item .= "<div class='point-content'>". $rendered_record[$description_field] ."</div>";
          }
          $descriptions[] = $item;
        }

This needs to go into a theme function.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zzolo’s picture

Title: Use theme function instead of hard-coded markup in Views display plugin » Use theme function instead of hard-coded markup in grouped Views display plugin

Please note that this is only the case for grouped output.

zzolo’s picture

Here is a patch. I dont have time to fully test (as there is a fair amount of work in setting it up to test)

It's fairly straightforward. One thing I did change was the CSS class names to be more Drupal friendly and to use consistent naming. @tmcw, I have a feeling that Managing News actually uses these selectors, but its just a guess?

tmcw’s picture

I'd assume other sites use those classes as well. Just include both classes.

tmcw’s picture

Status: Active » Needs work

This patch is missing a semicolon in the theme function, so it breaks Drupal at the bootstrap level. Please fix, and then retest, and then I think that this will be commit'able.

zzolo’s picture

Status: Needs work » Needs review
FileSize
4.48 KB

Updated patch with semicolon and current branch. Don't have much time again to set it up, so maybe someone already has it set up.

zzolo’s picture

Status: Needs review » Fixed
tmcw’s picture

Re: #3, I've added the other class in. Otherwise this needs a changelog entry. Unannounced, unnoted compatibility breakages are not all right.

Status: Fixed » Closed (fixed)

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