function custom_formatters_export_ui_form

elmsmedia7 custom_formatters.inc custom_formatters_export_ui_form(&$form, &$form_state)

Custom Formatters settings form.

1 string reference to 'custom_formatters_export_ui_form'
custom_formatters_custom_formatters_ctools_export_ui in sites/all/modules/local_contrib/custom_formatters/plugins/export_ui/custom_formatters.inc
CTools Export UI required function for plugin definition

File

sites/all/modules/local_contrib/custom_formatters/plugins/export_ui/custom_formatters.inc, line 44
CTools Export UI plugin for SexyBookmarks profiles.

Code

function custom_formatters_export_ui_form(&$form, &$form_state) {
  $form['#attached'] = array(
    'css' => array(
      drupal_get_path('module', 'custom_formatters') . '/styles/custom_formatters.css',
    ),
    'js' => array(
      drupal_get_path('module', 'custom_formatters') . '/scripts/custom_formatters.admin.js',
    ),
  );

  $item = $form_state['item'];
  $form['#item'] = $item;
  $form['#formatters'] = TRUE;

  $engines = module_invoke_all('custom_formatters_engine_info');
  $engine = !empty($form_state['values']['mode']) ? $form_state['values']['mode'] : (!empty($item->mode) ? $item->mode : key($engines));
  if (isset($engines[$engine]['file']) && file_exists($engines[$engine]['file'])) {
    require_once $engines[$engine]['file'];
  }

  $disable = FALSE;
  if ($form_state['op'] != 'add') {
    $disable = custom_formatters_formatter_is_active($item);
    if ($disable) {
      drupal_set_message(t('As the Formatter is currently in use, certain features have been disabled.'), 'warning');
    }
  }

  $form['info']['#title'] = t('Basic information');
  $form['info']['#type'] = 'fieldset';
  $form['info']['#collapsible'] = TRUE;
  $form['info']['#collapsed'] = $form_state['op'] != 'add';

  $form['info']['label']['#title'] = t('Formatter name');

  $form['info']['description'] = array(
    '#title' => t('Description'),
    '#type' => 'textarea',
    '#default_value' => $item->description,
  );

  $options = array();
  foreach ($engines as $key => $option) {
    $options[$key] = $option['label'];
  }
  $form['info']['mode'] = array(
    '#title' => t('Format'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $engine,
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js',
      'wrapper' => 'engine-wrapper',
    ),
  );

  $form['engine'] = array(
    '#type' => 'container',
    '#prefix' => '<div id="engine-wrapper">',
    '#suffix' => '</div>',
  );
  $form['engine']['field_types'] = array(
    '#title' => t('Field type(s)'),
    '#type' => 'textfield',
    '#default_value' => $item->field_types,
    '#required' => TRUE,
    '#description' => t('Enter a comma-separated list of field types (file, image, text, text_long, etc).'),
    '#autocomplete_path' => 'js/formatters/autocomplete',
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js',
      'wrapper' => 'engine-wrapper',
    ),
    '#disabled' => $disable,
  );
  $form['engine']['code'] = array(
    '#title' => t('Formatter'),
    '#type' => 'textarea',
    '#default_value' => !empty($item->code) ? $item->code : '',
    '#required' => TRUE,
    '#rows' => 10,
  );

  $options = _custom_formatters_preview_variables($form, $form_state);
  $form['engine']['preview'] = array(
    '#title' => t('Preview'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#weight' => 100,
    '#theme' => 'custom_formatters_export_ui_form_preview',
    '#tree' => TRUE,
  );
  $form['engine']['preview']['entity_type'] = array(
    '#title' => t('Entity type'),
    '#type' => 'select',
    '#options' => $options['entity_types'],
    '#default_value' => 'node',
    '#disabled' => empty($options['entity_types']),
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js',
      'wrapper' => 'engine-wrapper',
    ),
  );
  $form['engine']['preview']['bundle'] = array(
    '#title' => t('Bundle'),
    '#type' => 'select',
    '#options' => $options['bundles'],
    '#disabled' => empty($options['bundles']),
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js',
      'wrapper' => 'engine-wrapper',
    ),
  );
  $form['engine']['preview']['field'] = array(
    '#title' => t('Field'),
    '#type' => 'select',
    '#options' => $options['fields'],
    '#disabled' => empty($options['fields']),
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js',
      'wrapper' => 'engine-wrapper',
    ),
  );
  $form['engine']['preview']['entity'] = array(
    '#title' => t('Entity'),
    '#type' => 'select',
    '#options' => $options['entities'],
    '#disabled' => empty($options['entities']),
  );
  $form['engine']['preview']['options'] = array(
    '#type' => 'container',
  );
  $form['engine']['preview']['button'] = array(
    '#type' => 'button',
    '#value' => t('Preview'),
    '#ajax' => array(
      'callback' => 'custom_formatters_export_ui_form_js_preview',
      'wrapper' => 'preview-wrapper',
    ),
    '#disabled' => empty($options['entities']),
  );
  $form['engine']['preview']['preview'] = array(
    '#type' => 'container',
    '#prefix' => '<div id="preview-wrapper">',
    '#suffix' => '</div>',
  );

  $engines[$engine]['callbacks']['settings form']($form['engine'], $form_state, $item);

  $form['buttons']['edit'] = array(
    '#type' => 'submit',
    '#value' => t('Save & Edit'),
  );
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.