function rules_admin_add_component
Add component form.
1 string reference to 'rules_admin_add_component'
- rules_admin_menu in rules_admin/
rules_admin.module - Implements hook_menu().
File
-
rules_admin/
rules_admin.inc, line 363
Code
function rules_admin_add_component($form, &$form_state, $base_path) {
RulesPluginUI::$basePath = $base_path;
RulesPluginUI::formDefaults($form, $form_state);
$form['plugin_name'] = array(
'#type' => 'select',
'#title' => t('Component plugin'),
'#options' => rules_admin_component_options(),
'#description' => t('Choose which kind of component to create. Each component type is described in <a href="@url">the online documentation</a>.', array(
'@url' => rules_external_help('component-types'),
)),
'#weight' => -2,
'#default_value' => isset($form_state['values']['plugin_name']) ? $form_state['values']['plugin_name'] : '',
);
if (!isset($form_state['rules_config'])) {
$form['continue'] = array(
'#type' => 'submit',
'#name' => 'continue',
'#submit' => array(
'rules_admin_add_component_create_submit',
),
'#value' => t('Continue'),
);
}
else {
$form['plugin_name']['#disabled'] = TRUE;
$form_state['rules_config']->form($form, $form_state, array(
'show settings' => TRUE,
'button' => TRUE,
'init' => TRUE,
));
$form['settings']['#collapsible'] = FALSE;
$form['settings']['#type'] = 'container';
$form['settings']['label']['#default_value'] = '';
$form['settings']['#weight'] = -1;
// Hide the rule elements stuff for now.
foreach (array(
'elements',
'negate',
) as $key) {
$form[$key]['#access'] = FALSE;
}
foreach (array(
'active',
'weight',
) as $key) {
$form['settings'][$key]['#access'] = FALSE;
}
}
return $form;
}