Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getWords() {
- $query = new EntityFieldQuery();
- $query->entityCondition('entity_type', 'node', '=')
- ->propertyCondition('status', 1, '=')
- ->propertyCondition('type', 'wall_of_words', '=');
- $result = $query->execute();
- return node_load_multiple(array_keys($result['node']));
- $query = new EntityFieldQuery();
- $query->entityCondition('entity_type', 'node', '=')
- ->propertyCondition('status', 1, '=')
- ->propertyCondition('type', 'wall_of_words', '=');
- $result = $query->execute();
- $nodes = $result['node'];
- // Get all fields attached to a given node type
- $fields = field_info_instances('node', 'wall_of_words');
- // Get id of body field
- $field_id = $fields['body']['field_id'];
- // Attach a field of selected id only to get value for it
- field_attach_load('node', $nodes, FIELD_LOAD_CURRENT, array('field_id' => $field_id));
- foreach ($nodes AS $nid => $node) {
- print $node->body['und']['value'];
- }
- $result = db_select('node', 'n')
- ->fields('n', array('title', 'body'))
- ->condition('type', 'wall_of_words' ,'=')
- ->condition('status', 1 ,'=')
- ->execute()
- ->fetchAssoc();
Add Comment
Please, Sign In to add comment