• Reset your password
Home
OO PHP, Drupal, Symfony Developer and Architect
Tim Rabbetts

Main navigation

  • Home
  • Blog
  • Log in

Entity metadata wrappers to the rescue - Drupal 7

Breadcrumb

  • Home
  • blog
  • entity metadata wrappers to the rescue drupal 7
  • Entity metadata wrappers to the rescue - Drupal 7
Tim
Rabbetts
By zarexogre | Thu, 02/04/2020
computer, computer code, programming
php

This wrapping class is provided by the Entity API module, which I would highly recommend you run (more than likely you already are as it is required by some other modules).

How to use the API

// use entity metadata wrappers as they are SMART
$wrapper = entity_metadata_wrapper('node', $node);
dsm($wrapper->getPropertyInfo());

This will print out a list of all known fields on the node, and you can access properties easily. Once you have the $wrapper object defined you will now be able to use the below advanced syntax for quering values of fields.