Skip to content

Instantly share code, notes, and snippets.

@heddn
Created March 27, 2014 21:38
Show Gist options
  • Select an option

  • Save heddn/9819595 to your computer and use it in GitHub Desktop.

Select an option

Save heddn/9819595 to your computer and use it in GitHub Desktop.
$header = array();
$header[] = array(
'data' => t('title'),
'type' => 'property',
'specifier' => 'title',
'sort' => 'asc',
);
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'convention')
->propertyCondition('status', 1)
->addMetaData('account', user_load(1))
->tableSort($header);
$result = $query->execute();
if (isset($result['node'])) {
$nids = array_keys($result['node']);
$nodes = entity_load('node', $nids);
$rows = array();
foreach ($nodes as $node) {
$wrapper = entity_metadata_wrapper('node', $node);
$rows[] = array($wrapper->label());
}
dpm(theme('table', array('header' => $header, 'rows' => $rows)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment