public function UcAddressesEntityController::buildContent in Ubercart Addresses 7
Overrides EntityAPIController::buildContent().
Return value
array The renderable array.
Overrides EntityAPIController::buildContent
File
- class/
uc_addresses.entity.inc, line 149 - Entity integration code.
Class
- UcAddressesEntityController
- Ubercart Addresses entity controller class.
Code
public function buildContent($entity, $view_mode = 'full', $langcode = NULL, $content = array()) {
$address = $entity;
$address_user = user_load($address
->getUserId());
$options = array();
// Check address access.
if (UcAddressesPermissions::canViewAddress($address_user, $address)) {
// Check if address may be edited too.
if (UcAddressesPermissions::canEditAddress($address_user, $address)) {
// Show edit link.
$options['edit_link'] = TRUE;
}
if (UcAddressesPermissions::canDeleteAddress($address_user, $address)) {
// Show delete link.
$options['delete_link'] = TRUE;
}
$content['#theme'] = 'uc_addresses_list_address';
$content['#address'] = $address;
$content['#options'] = $options;
$content['#attached'] = array(
'css' => array(
drupal_get_path('module', 'uc_addresses') . '/uc_addresses.css',
),
);
}
else {
$content['#access'] = FALSE;
}
return parent::buildContent($entity, $view_mode, $langcode, $content);
}