You are here

function _node_registration_fake_field in Node registration 7

Implements hook_entity_property_info_alter().

1 call to _node_registration_fake_field()
NodeRegistrationEntityClass::buildContent in includes/node_registration.entity.inc
Override buildContent() to add registration properties.

File

includes/node_registration.entity.inc, line 310
Entity hooks and callbacks for registrations.

Code

function _node_registration_fake_field(&$renderable, $machine_name, $title, $content, $show_title = TRUE) {
  $content = isset($content[0]) ? array_values($content) : array(
    $content,
  );
  $items = array_fill(0, count($content), $machine_name);
  $renderable[$machine_name] = array(
    // These are necessary for correct display.
    '#theme' => 'field',
    '#field_name' => $machine_name,
    '#title' => $title,
    '#label_display' => $show_title ? 'above' : 'hidden',
    '#bundle' => $machine_name,
    '#items' => $items,
  ) + $content + array(
    // These are necessary for other modules' preprocessors.
    '#field_type' => 'custom',
    '#entity_type' => 'custom',
    '#bundle' => 'custom',
    '#object' => new stdClass(),
  );
}