public function EntityDefaultI18nStringController::hook_object_info in Entity API 7
Implements hook_i18n_object_info() via entity_i18n_object_info().
Go with the same default values as the admin UI as far as possible.
File
- ./
entity.i18n.inc, line 135 - Internationalization (i18n) integration.
Class
- EntityDefaultI18nStringController
- Default controller handling i18n integration.
Code
public function hook_object_info() {
$wildcard = $this
->menuWildcard();
$id_key = !empty($this->entityInfo['entity keys']['name']) ? $this->entityInfo['entity keys']['name'] : $this->entityInfo['entity keys']['id'];
$info[$this->entityType] = array(
// Generic object title.
'title' => $this->entityInfo['label'],
// The object key field.
'key' => $id_key,
// Placeholders for automatic paths.
'placeholders' => array(
$wildcard => $id_key,
),
// Properties for string translation.
'string translation' => array(
// Text group that will handle this object's strings.
'textgroup' => $this->textgroup,
// Object type property for string translation.
'type' => $this->entityType,
// Translatable properties of these objects.
'properties' => $this
->translatableProperties(),
),
);
// Integrate the translate tab into the admin-UI if enabled.
if ($base_path = $this
->menuBasePath()) {
$info[$this->entityType] += array(
// To produce edit links automatically.
'edit path' => $base_path . '/manage/' . $wildcard,
// Auto-generate translate tab.
'translate tab' => $base_path . '/manage/' . $wildcard . '/translate',
);
$info[$this->entityType]['string translation'] += array(
// Path to translate strings to every language.
'translate path' => $base_path . '/manage/' . $wildcard . '/translate/%i18n_language',
);
}
return $info;
}