public function RedhenContact::buildContent in RedHen CRM 7
Override buildContent() to add contact properties.
Overrides Entity::buildContent
File
- modules/
redhen_contact/ lib/ redhen_contact.entity.inc, line 39 - Redhen Contact entity classses.
Class
- RedhenContact
- The class used for contact entities.
Code
public function buildContent($view_mode = 'full', $langcode = NULL) {
$wrapper = entity_metadata_wrapper('redhen_contact', $this);
$user = $wrapper->user
->value();
$name = check_plain($wrapper->full_name
->value());
$content['redhen_state'] = array(
'#theme' => 'redhen_property_field',
'#label' => t('State'),
'#items' => array(
array(
'#markup' => $this->redhen_state == REDHEN_STATE_ACTIVE ? t('Active') : t('Inactive'),
),
),
'#classes' => 'field field-label-inline clearfix',
);
if (!empty($name)) {
$content['name'] = array(
'#theme' => 'redhen_property_field',
'#label' => t('Name'),
'#items' => array(
array(
'#markup' => $name,
),
),
'#classes' => 'field field-label-inline clearfix',
'#attributes' => '',
);
}
if ($user) {
$user_uri = entity_uri('user', $user);
$content['user'] = array(
'#theme' => 'redhen_property_field',
'#label' => t('Drupal User'),
'#items' => array(
array(
'#markup' => l($user->name, $user_uri['path']),
),
),
'#classes' => 'field field-label-inline clearfix',
'#attributes' => '',
);
}
return entity_get_controller($this->entityType)
->buildContent($this, $view_mode, $langcode, $content);
}