You are here

function entity_metadata_node_entity_property_info_alter in Entity API 7

Implements hook_entity_property_info_alter() on top of node module.

See also

entity_metadata_entity_property_info_alter()

File

modules/node.info.inc, line 155
Provides info about the node entity.

Code

function entity_metadata_node_entity_property_info_alter(&$info) {

  // Move the body property to the node by default, as its usually there this
  // makes dealing with it more convenient.
  $info['node']['properties']['body'] = array(
    'type' => 'text_formatted',
    'label' => t('The main body text'),
    'getter callback' => 'entity_metadata_field_verbatim_get',
    'setter callback' => 'entity_metadata_field_verbatim_set',
    'property info' => entity_property_text_formatted_info(),
    'auto creation' => 'entity_property_create_array',
    'field' => TRUE,
  );

  // Make it a list if cardinality is not 1.
  $field_body = field_info_field('body');
  if (isset($field_body) && $field_body['cardinality'] != 1) {
    $info['node']['properties']['body']['type'] = 'list<text_formatted>';
  }
}