class TMGMTJobItemUIController in Translation Management Tool 7
Entity UI controller for the Job Entity.
Hierarchy
- class \EntityDefaultUIController
- class \TMGMTJobItemUIController
Expanded class hierarchy of TMGMTJobItemUIController
1 string reference to 'TMGMTJobItemUIController'
- tmgmt_ui_entity_info in ui/
tmgmt_ui.module - Implements hook_entity_info().
File
- ui/
includes/ tmgmt_ui.controller.job_item.inc, line 11 - Contains the job item UI controller.
View source
class TMGMTJobItemUIController extends EntityDefaultUIController {
/**
* {@inheritdoc}
*/
public function hook_menu() {
$id_count = count(explode('/', $this->path));
$wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object';
$items[$this->path . '/' . $wildcard] = array(
'title callback' => 'entity_label',
'title arguments' => array(
$this->entityType,
$id_count,
),
'page callback' => 'tmgmt_ui_job_item_view',
'page arguments' => array(
$id_count,
),
'load arguments' => array(
$this->entityType,
),
'access callback' => 'entity_access',
'access arguments' => array(
'view',
'tmgmt_job_item',
$id_count,
),
'file' => $this->entityInfo['admin ui']['file'],
'file path' => $this->entityInfo['admin ui']['file path'],
);
$items[$this->path . '/' . $wildcard . '/view'] = array(
'title' => 'View',
'load arguments' => array(
$this->entityType,
),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items[$this->path . '/' . $wildcard . '/reject/%'] = array(
'title' => 'Reject',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'tmgmt_ui_translation_review_form_reject_confirm',
$id_count,
$id_count + 2,
),
'load arguments' => array(
$this->entityType,
),
'access callback' => 'entity_access',
'access arguments' => array(
'accept',
$this->entityType,
$id_count,
),
'type' => MENU_VISIBLE_IN_BREADCRUMB,
'file' => $this->entityInfo['admin ui']['file'],
'file path' => $this->entityInfo['admin ui']['file path'],
);
$items[$this->path . '/' . $wildcard . '/delete'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
$this->entityType . '_operation_form',
$this->entityType,
$id_count,
$id_count + 1,
),
'load arguments' => array(
$this->entityType,
),
'access callback' => 'entity_access',
'access arguments' => array(
'delete',
$this->entityType,
$id_count,
),
'type' => MENU_CALLBACK,
);
$items[$this->path . '/' . $wildcard . '/accept'] = array(
'page callback' => 'drupal_get_form',
'page arguments' => array(
$this->entityType . '_operation_form',
$this->entityType,
$id_count,
$id_count + 1,
),
'load arguments' => array(
$this->entityType,
),
'access callback' => 'entity_access',
'access arguments' => array(
'accept',
$this->entityType,
$id_count,
),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* {@inheritdoc}
*/
public function operationForm($form, &$form_state, $entity, $op) {
$controller = $entity
->getSourceController();
$info = $controller
->pluginInfo();
switch ($op) {
case 'delete':
$confirm_question = t('Are you sure you want to delete the %plugin translation job item for %label?', array(
'%plugin' => $info['label'],
'%label' => $entity
->label(),
));
return confirm_form($form, $confirm_question, $this->path);
case 'accept':
$confirm_question = t('Are you sure you want to accept the %plugin translation job item for %label?', array(
'%plugin' => $info['label'],
'%label' => $entity
->label(),
));
return confirm_form($form, $confirm_question, $this->path);
}
drupal_not_found();
exit;
}
/**
* {@inheritdoc}
*/
public function applyOperation($op, $entity) {
switch ($op) {
case 'delete':
$entity
->delete();
return t('The translation job item %label has been deleted.', array(
'%label' => $entity
->label(),
));
case 'accept':
$entity
->accepted('The translation job item has been accepted by !user.', array(
'!user' => theme('username', array(
'account' => $GLOBALS['user'],
)),
));
return t('The translation job item %label has been accepted.', array(
'%label' => $entity
->label(),
));
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
protected | property | ||
EntityDefaultUIController:: |
public | property | Defines the number of entries to show per page in overview table. | |
EntityDefaultUIController:: |
public | function | Entity submit builder invoked via entity_ui_form_submit_build_entity(). | |
EntityDefaultUIController:: |
public | function | Provides definitions for implementing hook_forms(). | |
EntityDefaultUIController:: |
protected | function | Returns the operation count for calculating colspans. | |
EntityDefaultUIController:: |
public | function | Operation form submit callback. | 1 |
EntityDefaultUIController:: |
public | function | Operation form validation callback. | |
EntityDefaultUIController:: |
public | function | Builds the entity overview form. | |
EntityDefaultUIController:: |
public | function | Overview form submit callback. | |
EntityDefaultUIController:: |
public | function | Overview form validation callback. | |
EntityDefaultUIController:: |
public | function | Generates the render array for a overview table for arbitrary entities matching the given conditions. | |
EntityDefaultUIController:: |
protected | function | Generates the table headers for the overview table. | |
EntityDefaultUIController:: |
protected | function | Generates the row for the passed entity and may be overridden in order to customize the rows. | |
EntityDefaultUIController:: |
public | function | ||
TMGMTJobItemUIController:: |
public | function |
Applies an operation to the given entity. Overrides EntityDefaultUIController:: |
|
TMGMTJobItemUIController:: |
public | function |
Provides definitions for implementing hook_menu(). Overrides EntityDefaultUIController:: |
|
TMGMTJobItemUIController:: |
public | function |
Builds the operation form. Overrides EntityDefaultUIController:: |