class CommerceDiscountUIController in Commerce Discount 7
Class CommerceDiscountUIController.
Hierarchy
- class \EntityDefaultUIController
- class \CommerceDiscountUIController
Expanded class hierarchy of CommerceDiscountUIController
1 string reference to 'CommerceDiscountUIController'
- commerce_discount_entity_info in ./
commerce_discount.module - Implements hook_entity_info().
File
- includes/
commerce_discount.admin.inc, line 11 - Commerce discount editing UI.
View source
class CommerceDiscountUIController extends EntityDefaultUIController {
/**
* {@inheritdoc}
*/
public function entityFormSubmitBuildEntity($form, &$form_state) {
// We cannot use entity_form_submit_build_entity() any more.
$entity = $form_state['commerce_discount'];
// Extract form values.
form_state_values_clean($form_state);
foreach ($form_state['values'] as $key => $value) {
if ($key != 'commerce_discount_fields') {
$entity->{$key} = $value;
}
else {
$discount_offer = $value['commerce_discount_offer'][LANGUAGE_NONE]['form'];
unset($discount_offer['actions']);
$entity->commerce_discount_offer['commerce_discount_fields'] = $discount_offer;
}
}
// Invoke all specified builders for copying values to entity properties.
// @see entity_form_submit_build_entity()
if (isset($form['#entity_builders'])) {
foreach ($form['#entity_builders'] as $function) {
$function('commerce_discount', $entity, $form, $form_state);
}
}
field_attach_submit('commerce_discount', $entity, $form['commerce_discount_fields'], $form_state);
return $entity;
}
/**
* Overridden EntityDefaultUIController::hook_menu().
*
* Call our own page callback to show the "commerce_discount_overview"
* view, as this view has exposed filters which will not work inside
* Entity API's default form.
*/
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path] = array(
'title' => 'Discounts',
'description' => 'Manage discounts.',
'page callback' => 'commerce_discount_overview_form',
'access callback' => 'entity_access',
'access arguments' => array(
'view',
$this->entityType,
),
'file' => 'includes/commerce_discount.admin.inc',
'file path' => drupal_get_path('module', 'commerce_discount'),
);
$items[$this->path . '/list'] = array(
'title' => 'List',
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[$this->path . '/add']['title callback'] = 't';
$items[$this->path . '/import']['title callback'] = 't';
$items[$this->path . '/add']['title'] = 'Add discount';
$items[$this->path . '/import']['title'] = 'Import discount';
$items[$this->path . '/settings'] = array(
'title' => 'Settings',
'description' => 'Additional settings for Commerce Discounts.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'commerce_discount_settings',
),
'access arguments' => array(
'administer commerce discounts',
),
'type' => MENU_LOCAL_TASK,
'file' => 'includes/commerce_discount.admin.inc',
'file path' => drupal_get_path('module', 'commerce_discount'),
);
if (module_exists('rules_admin')) {
$items[$this->path . '/rules'] = array(
'title' => 'Discount rules',
'description' => 'Manage discount rules',
'page callback' => 'drupal_goto',
'page arguments' => array(
'admin/config/workflow/rules',
array(
'query' => array(
'event' => 0,
'tag' => 'Commerce Discount',
),
),
),
'access arguments' => array(
'administer commerce discounts',
),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
}
return $items;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceDiscountUIController:: |
public | function |
Entity submit builder invoked via entity_ui_form_submit_build_entity(). Overrides EntityDefaultUIController:: |
|
CommerceDiscountUIController:: |
public | function |
Overridden EntityDefaultUIController::hook_menu(). Overrides EntityDefaultUIController:: |
|
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 | 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 |