class PollimUIController in Poll Improved 7
UI controller.
Hierarchy
- class \EntityDefaultUIController
- class \PollimUIController
Expanded class hierarchy of PollimUIController
1 string reference to 'PollimUIController'
- pollim_entity_info in ./
pollim.module - Implement hook_entity_info().
File
- ./
pollim.admin.inc, line 15 - Pollim editing UI.
View source
class PollimUIController extends EntityDefaultUIController {
/**
* Overrides hook_menu() defaults. Main reason for doing this is that
* parent class hook_menu() is optimized for entity type administration.
*/
public function hook_menu() {
$items = array();
$id_count = count(explode('/', $this->path));
$wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%' . $this->entityType;
$items[$this->path] = array(
'title' => 'Improved Polls',
'description' => 'Add edit and update polls.',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array(
'access administration pages',
),
'file path' => drupal_get_path('module', 'system'),
'file' => 'system.admin.inc',
);
// Change the overview menu type for the list of pollims.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Change the add page menu to multiple types of entities
$items[$this->path . '/add'] = array(
'title' => 'Add an Improved Poll',
'description' => 'Add a new Poll',
'page callback' => 'pollim_add_page',
'access callback' => 'pollim_access',
'access arguments' => array(
'edit',
),
'type' => MENU_NORMAL_ITEM,
'weight' => 20,
'file' => 'pollim.admin.inc',
'file path' => drupal_get_path('module', $this->entityInfo['module']),
);
// Add menu items to add each different type of entity.
foreach (pollim_get_types() as $type) {
$items[$this->path . '/add/' . $type->type] = array(
'title' => 'Add ' . $type->label,
'page callback' => 'pollim_form_wrapper',
'page arguments' => array(
pollim_create(array(
'type' => $type->type,
)),
),
'access callback' => 'pollim_access',
'access arguments' => array(
'edit',
'edit ' . $type->type,
),
'file' => 'pollim.admin.inc',
'file path' => drupal_get_path('module', $this->entityInfo['module']),
);
}
// Loading and editing pollim entities
$items[$this->path . '/pollim/' . $wildcard] = array(
'page callback' => 'pollim_form_wrapper',
'page arguments' => array(
$id_count + 1,
),
'access callback' => 'pollim_access',
'access arguments' => array(
'edit',
$id_count + 1,
),
'weight' => 0,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
'file' => 'pollim.admin.inc',
'file path' => drupal_get_path('module', $this->entityInfo['module']),
);
$items[$this->path . '/pollim/' . $wildcard . '/edit'] = array(
'title' => 'Edit',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
);
$items[$this->path . '/pollim/' . $wildcard . '/delete'] = array(
'title' => 'Delete',
'page callback' => 'pollim_delete_form_wrapper',
'page arguments' => array(
$id_count + 1,
),
'access callback' => 'pollim_access',
'access arguments' => array(
'edit',
$id_count + 1,
),
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_INLINE,
'weight' => 10,
'file' => 'pollim.admin.inc',
'file path' => drupal_get_path('module', $this->entityInfo['module']),
);
// Menu item for viewing pollims
$items['pollim/' . $wildcard] = array(
//'title' => 'Title',
'title callback' => 'pollim_page_title',
'title arguments' => array(
1,
),
'page callback' => 'pollim_page_view',
'page arguments' => array(
1,
),
'access callback' => 'pollim_access',
'access arguments' => array(
'view',
1,
),
'type' => MENU_CALLBACK,
);
return $items;
}
/**
* Create the markup for the add Pollim Entities page within the class
* so it can easily be extended/overriden.
*/
public function addPage() {
$item = menu_get_item();
$content = system_admin_menu_block($item);
if (count($content) == 1) {
$item = array_shift($content);
drupal_goto($item['href']);
}
return theme('pollim_add_list', array(
'content' => $content,
));
}
}
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 | Applies an operation to the given entity. | |
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 | Builds the operation form. | |
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 | ||
PollimUIController:: |
public | function | Create the markup for the add Pollim Entities page within the class so it can easily be extended/overriden. | |
PollimUIController:: |
public | function |
Overrides hook_menu() defaults. Main reason for doing this is that
parent class hook_menu() is optimized for entity type administration. Overrides EntityDefaultUIController:: |