function deploy_ui_plan::edit_form in Deploy - Content Staging 7.2
Same name and namespace in other branches
- 7.3 modules/deploy_ui/plugins/export_ui/deploy_ui_plan.class.php \deploy_ui_plan::edit_form()
Form callback for basic config.
Overrides ctools_export_ui::edit_form
File
- modules/
deploy_ui/ plugins/ export_ui/ deploy_ui_plan.class.php, line 28 - Deploy UI for managing deployment plans.
Class
- deploy_ui_plan
- CTools Export UI class for deployment plans.
Code
function edit_form(&$form, &$form_state) {
$item = $form_state['item'];
// Basics.
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#default_value' => $item->title,
'#required' => TRUE,
);
$form['name'] = array(
'#type' => 'machine_name',
'#title' => t('Machine-readable name'),
'#default_value' => $item->name,
'#required' => TRUE,
'#machine_name' => array(
'exists' => 'deploy_plan_load',
'source' => array(
'title',
),
),
);
$form['description'] = array(
'#type' => 'textarea',
'#title' => t('Description'),
'#default_value' => $item->description,
);
$form['debug'] = array(
'#type' => 'checkbox',
'#title' => t('Debug mode'),
'#description' => t('Check this to enable debug mode with extended watchdog logging.'),
'#default_value' => $item->debug,
);
// Aggregators.
$aggregators = deploy_get_aggregator_plugins();
$options = array();
foreach ($aggregators as $key => $aggregator) {
$options[$key] = array(
'name' => $aggregator['name'],
'description' => $aggregator['description'],
);
}
$form['aggregator_plugin'] = array(
'#prefix' => '<label>' . t('Aggregator') . '</label>',
'#type' => 'tableselect',
'#required' => TRUE,
'#multiple' => FALSE,
'#header' => array(
'name' => t('Name'),
'description' => t('Description'),
),
'#options' => $options,
'#default_value' => $item->aggregator_plugin,
);
// Fetch options.
$form['fetch_only'] = array(
'#title' => t('Fetch only'),
'#description' => t("Select this if the content of this plan is intended to be <em>fetch-only</em> by any type of event or endpoint. This means that the plan wont have a processor or defined endpoint."),
'#type' => 'checkbox',
'#default_value' => $item->fetch_only,
);
$form['deployment_process'] = array(
'#type' => 'fieldset',
'#title' => t('Deployment process'),
'#description' => t('Configure how the deployment process should behave.'),
'#states' => array(
'invisible' => array(
':input[name="fetch_only"]' => array(
'checked' => TRUE,
),
),
),
);
// Processors.
$processors = deploy_get_processor_plugins();
$options = array();
foreach ($processors as $key => $processor) {
$options[$key] = array(
'name' => $processor['name'],
'description' => $processor['description'],
);
}
$form['deployment_process']['processor_plugin'] = array(
'#prefix' => '<label>' . t('Processor') . '</label>',
'#type' => 'tableselect',
'#required' => FALSE,
'#multiple' => FALSE,
'#header' => array(
'name' => t('Name'),
'description' => t('Description'),
),
'#options' => $options,
'#default_value' => $item->processor_plugin,
);
// Endpoints.
$endpoints = deploy_endpoint_load_all();
$options = array();
foreach ($endpoints as $endpoint) {
$options[$endpoint->name] = array(
'name' => check_plain($endpoint->title),
'description' => check_plain($endpoint->description),
);
}
if (!is_array($item->endpoints)) {
$item->endpoints = unserialize($item->endpoints);
}
$form['deployment_process']['endpoints'] = array(
'#prefix' => '<label>' . t('Endpoints') . '</label>',
'#type' => 'tableselect',
'#required' => FALSE,
'#empty' => t('No endpoints exists at the moment. <a href="!url">Go and create one</a>.', array(
'!url' => url('admin/structure/deploy/endpoints'),
)),
'#multiple' => TRUE,
'#header' => array(
'name' => t('Name'),
'description' => t('Description'),
),
'#options' => $options,
'#default_value' => (array) $item->endpoints,
);
// Dependency plugin.
$form['dependency_iterator'] = array(
'#type' => 'fieldset',
'#title' => t('Dependency plugin'),
'#description' => t('The iterator to handle the dependencies of the deployment plan'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['dependency_iterator']['dependency_plugin'] = array(
'#type' => 'select',
'#title' => t('Plugin'),
'#options' => entity_dependency_get_all_ctools_plugins(),
'#default_value' => $item->dependency_plugin,
'#required' => TRUE,
);
}