You are here

public function deploy_ui_endpoint::edit_form in Deploy - Content Staging 7.3

Same name and namespace in other branches
  1. 7.2 modules/deploy_ui/plugins/export_ui/deploy_ui_endpoint.class.php \deploy_ui_endpoint::edit_form()

Form callback for basic config.

Overrides ctools_export_ui::edit_form

File

modules/deploy_ui/plugins/export_ui/deploy_ui_endpoint.class.php, line 29
CTools export UI implementation for deploy endpoints.

Class

deploy_ui_endpoint
Deploy endpoint UI class that extends CTools Export UI.

Code

public 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_endpoint_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,
  );

  // Authenticators.
  $authenticators = deploy_get_authenticator_plugins();
  $options = array();
  foreach ($authenticators as $key => $authenticator) {
    $options[$key] = array(
      'name' => $authenticator['name'],
      'description' => $authenticator['description'],
    );
  }
  $form['authenticator_plugin'] = array(
    '#prefix' => '<label>' . t('Authenticator') . '</label>',
    '#type' => 'tableselect',
    '#required' => TRUE,
    '#multiple' => FALSE,
    '#header' => array(
      'name' => t('Name'),
      'description' => t('Description'),
    ),
    '#options' => $options,
    '#default_value' => $item->authenticator_plugin,
  );

  // Services.
  $services = deploy_get_service_plugins();
  $options = array();
  foreach ($services as $key => $service) {
    $options[$key] = array(
      'name' => $service['name'],
      'description' => $service['description'],
    );
  }
  $form['service_plugin'] = array(
    '#prefix' => '<label>' . t('Service') . '</label>',
    '#type' => 'tableselect',
    '#required' => TRUE,
    '#multiple' => FALSE,
    '#header' => array(
      'name' => t('Name'),
      'description' => t('Description'),
    ),
    '#options' => $options,
    '#default_value' => $item->service_plugin,
  );
}