Hello,

Just to precise how to use the excellent popup in Views via a PHP snippet (took me days to find out how).

* Dont use Display Field code Fields in Views with table format, as those Fields can not be shown on a View Table (you have to select in Views:
FORMAT
Format:Unformatted list | Settings
Show:Display suite | Settings
And in your Content Type / Manage Display / Display Suite / show your Field Code).

* Far better to use Computed Field http://drupal.org/project/computed_field to create a Field in your content type calling your popup:
- Store Value in Database: Yes
- Database Storage Setting: longtext

Example of Php Snippet in Computed Field to adapt below:

module_load_include('inc', 'popup', 'includes/popup.api');

$category=$entity->field_category['und'][0]['value'];
$uid=$entity->uid;
$questiongid=db_query("SELECT gid FROM {og} WHERE etid =".($entity->nid)."")->fetchField();

if (($category === 'OTHER') or (strcmp($category,'OTHER')==0)) {

 $tagsnids=db_query("SELECT nid FROM {node} WHERE ((title LIKE '".($entity->title)."') AND (type LIKE 'tags'))")->FetchCol();
 $myargs=$questiongid.",";
 $inc=0;
 foreach ($tagsnids as $tagsnid) {
  if ($inc == 0) {
   $myargs=$myargs.$tagsnid;
   $inc=$inc+1;
  }
  else {
   $myargs=$myargs."+".$tagsnid;
  }
 }
 $entity_field[0]['value'] =  popup(array('view' => '_og_content_og_question_sorted','args'=>$myargs,'activate' => 'click','close' => TRUE, 'ajax' => 1, 'width' => 905,'origin'=>'bottom-left','expand'=>'bottom-right','opacity'=>1.0,'effect'=>'fade'));

}
elseif (($category === 'NEW') or (strcmp($category,'NEW')==0))  {
 
   $entity_field[0]['value'] =  popup(array('view' => 'og_content_og_open_question','args'=>$questiongid,'activate' => 'click','close' => TRUE, 'ajax' => 1, 'width' => 905,'origin'=>'bottom-left','expand'=>'bottom-right','opacity'=>2.0,'effect'=>'fade'));

}

L

Comments

Leoo’s picture

Issue summary: View changes

none

Leoo’s picture

Issue summary: View changes

none

WorldFallz’s picture

for anyone else stumbling across this, https://drupal.org/project/popup_views_integration

works great.