Skip to content

Instantly share code, notes, and snippets.

@juampynr
Created March 19, 2014 17:16
Show Gist options
  • Save juampynr/9646530 to your computer and use it in GitHub Desktop.
Save juampynr/9646530 to your computer and use it in GitHub Desktop.
5f37bb91 (Dave Reid 2011-08-12 09:19:12 -0500 367) }
a83b0c82 (Dave Reid 2012-03-27 19:22:59 -0500 368)
8f0209d0 (colan 2012-11-03 20:36:51 -0400 369) // Get all translations of tag data for this entity.
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 370) $result = db_query("SELECT entity_id, revision_id, language, data FROM {metatag} WHE
1ee36b5c (Damien McKenna 2013-03-04 07:44:23 -0500 371) ':type' => $entity_type,
1ee36b5c (Damien McKenna 2013-03-04 07:44:23 -0500 372) ':ids' => $entity_ids,
f911e5c0 (Damien McKenna 2013-07-24 15:11:23 -0400 373) ));
8f0209d0 (colan 2012-11-03 20:36:51 -0400 374)
8f0209d0 (colan 2012-11-03 20:36:51 -0400 375) // Marshal it into an array keyed by entity ID. Each value is an array of
8f0209d0 (colan 2012-11-03 20:36:51 -0400 376) // translations keyed by language code.
8f0209d0 (colan 2012-11-03 20:36:51 -0400 377) $metatags = array();
8f0209d0 (colan 2012-11-03 20:36:51 -0400 378) while ($record = $result->fetchObject()) {
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 379) // If requested, verify that only the appropriate revision records are
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 380) // loaded.
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 381) if (empty($revision_ids) || in_array($record->revision_id, $revision_ids)) {
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 382) $metatags[$record->entity_id][$record->revision_id][$record->language] = unseria
6fbd22a5 (Damien McKenna 2013-12-31 19:10:23 -0500 383) }
8f0209d0 (colan 2012-11-03 20:36:51 -0400 384) }
8f0209d0 (colan 2012-11-03 20:36:5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment