protected function TMGMTTranslatorUIController::overviewFormRow in Translation Management Tool 7
Helper method for building a row in the overview form.
1 call to TMGMTTranslatorUIController::overviewFormRow()
- TMGMTTranslatorUIController::overviewForm in ui/
includes/ tmgmt_ui.controller.translator.inc - Builds the entity overview form.
File
- ui/
includes/ tmgmt_ui.controller.translator.inc, line 69 - Contains the translator UI controller.
Class
- TMGMTTranslatorUIController
- Entity UI controller for the Translator Entity.
Code
protected function overviewFormRow($form, &$form_state, $entity, $id) {
$form['#weight'] = isset($form_state['input']['translators']) ? $form_state['input']['translators'][$id]['weight'] : NULL;
$form['label'] = array(
'#theme' => 'tmgmt_ui_translator_overview_item',
'#attached' => array(
'css' => array(
drupal_get_path('module', 'tmgmt_ui') . '/css/tmgmt_ui.admin.css',
),
),
'#label' => $entity
->label(),
'#name' => !empty($this->entityInfo['exportable']) ? entity_id($this->entityType, $entity) : FALSE,
'#url' => FALSE,
'#description' => $entity->description,
'#entity_type' => $this->entityType,
);
// Add a row for the exportable status.
if (!empty($this->entityInfo['exportable'])) {
$form['status'] = array(
'#theme' => 'entity_status',
'#status' => $entity->{$this->statusKey},
);
}
$wrapper = entity_metadata_wrapper($this->entityType, $entity);
// Add a column to show the translator plugin via the metadata wrapper.
$form['plugin'] = array(
'#markup' => $wrapper->plugin
->label(),
'#status' => $entity->{$this->statusKey},
);
$controller = $entity
->getController();
$form['configured'] = array(
'#markup' => $controller
->isAvailable($entity) ? t('Yes') : t('No'),
);
$form['weight'] = array(
'#type' => 'weight',
'#delta' => 30,
'#default_value' => $entity->weight,
);
// Add operations depending on the status.
if (entity_has_status($this->entityType, $entity, ENTITY_FIXED)) {
$form['operations']['clone'] = array(
'#type' => 'link',
'#title' => t('clone'),
'#href' => $this->path . '/manage/' . $id . '/clone',
);
}
else {
$form['operations']['edit'] = array(
'#type' => 'link',
'#title' => t('edit'),
'#href' => $this->path . '/manage/' . $id,
);
if (!empty($this->entityInfo['exportable'])) {
$form['operations']['clone'] = array(
'#type' => 'link',
'#title' => t('clone'),
'#href' => $this->path . '/manage/' . $id . '/clone',
);
}
if (empty($this->entityInfo['exportable']) || !entity_has_status($this->entityType, $entity, ENTITY_IN_CODE)) {
$form['operations']['delete'] = array(
'#type' => 'link',
'#title' => t('delete'),
'#href' => $this->path . '/manage/' . $id . '/delete',
'#options' => array(
'query' => drupal_get_destination(),
),
);
}
elseif (entity_has_status($this->entityType, $entity, ENTITY_OVERRIDDEN)) {
$form['operations']['revert'] = array(
'#type' => 'link',
'#title' => t('revert'),
'#href' => $this->path . '/manage/' . $id . '/revert',
'#options' => array(
'query' => drupal_get_destination(),
),
);
}
else {
$row[] = '';
}
}
if (!empty($this->entityInfo['exportable'])) {
$form['operations']['export'] = array(
'#type' => 'link',
'#title' => t('export'),
'#href' => $this->path . '/manage/' . $id . '/export',
);
}
return $form;
}