You are here

function config_pages_content_content_type_edit_form in Config Pages 7

Returns an edit form for the custom type.

File

plugins/content_types/content/content.inc, line 56
Node content CCT.

Code

function config_pages_content_content_type_edit_form($form, &$form_state) {

  // Config holder.
  $conf = $form_state['conf'];
  $form['conf'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configuration'),
    '#tree' => TRUE,
  );

  // Generate bundle list.
  $entity = entity_get_info('config_pages');
  $bundle_options = array();
  $bundle_options['_none'] = t('Use value from context');
  foreach ($entity['bundles'] as $bundle => $option) {
    $bundle_options[$bundle] = $option['label'];
  }
  $form['conf']['bundle'] = array(
    '#title' => t('Config Page'),
    '#type' => 'select',
    '#description' => t('Select config page to render.'),
    '#options' => $bundle_options,
    '#default_value' => $conf['bundle'],
  );

  // Generate view mode list.
  $view_mode_options = array();
  foreach ($entity['view modes'] as $mode => $option) {
    $view_mode_options[$mode] = $option['label'];
  }
  $form['conf']['view_mode'] = array(
    '#title' => t('View mode'),
    '#type' => 'select',
    '#description' => t('Select a view mode for this config page.'),
    '#options' => $view_mode_options,
    '#default_value' => $conf['view_mode'],
  );
  return $form;
}