function commerce_stock_admin_stock_control_rules in Commerce Stock 7.2
Builds the stock control rules page.
1 string reference to 'commerce_stock_admin_stock_control_rules'
- commerce_stock_ui_menu in ./
commerce_stock_ui.module - Implements hook_menu().
File
- includes/
commerce_stock.admin.inc, line 89 - Administrative callbacks and form builder functions for Commerce Stock.
Code
function commerce_stock_admin_stock_control_rules() {
// Add a help section.
$content['help'] = array(
'#type' => 'fieldset',
'#title' => t('Stock control'),
);
$content['help']['about']['#markup'] = t('<p>Manage Stock control / backend rules. Those are rules that effect and act on stock levels.</p>');
$content['help']['add_existing']['#markup'] = t('<p>To add existing rules to the stock control management screen, simply tag them with <strong>stock_control</strong>.</p>');
RulesPluginUI::$basePath = 'admin/commerce/config/stock/control';
$options = array(
'show plugin' => FALSE,
);
$content['enabled'] = array(
'#type' => 'fieldset',
'#title' => t('Enabled Stock control rules'),
);
$content['disabled'] = array(
'#type' => 'fieldset',
'#title' => t('Disabled Stock control rules'),
);
// The conditions array.
$conditions = array(
'plugin' => 'reaction rule',
);
$conditions['tags'] = array(
'stock_control',
);
// Enabled rules.
$conditions['active'] = TRUE;
$content['enabled']['rules'] = RulesPluginUI::overviewTable($conditions, $options);
$content['enabled']['rules']['#empty'] = t('There are no active rules.');
// Disabled rules.
$conditions['active'] = FALSE;
$content['disabled']['rules'] = RulesPluginUI::overviewTable($conditions, $options);
$content['disabled']['rules']['#empty'] = t('There are no disabled rules.');
return $content;
}