Views argument handling code: get gid from pretty group path


/ Published in: PHP
Save to your folder(s)

Add this arg code plus set first argument as "OG: Group nid(s)"


Copy this code and paste it in your HTML
  1. // get the node id for the group
  2. // expecting site urls to be in format group/group-name
  3. // HACK: get the internal (source) url from the first part of the path with arg, expecting to find 'group/group-name'
  4. $group_url = drupal_lookup_path('source', 'group/'.$args[0]);
  5. // extract the group node id
  6. $group_url_exploded = explode('/', $group_url);
  7. $args[0] = $group_url_exploded[1];
  8.  
  9. return $args;

URL: http://www.ninelanterns.com.au

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.