You are here

function fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form in Fieldable Panels Panes (FPP) 7

Form used to edit our content type.

1 string reference to 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form'
fieldable_panels_panes_fieldable_panels_pane_ctools_content_types in plugins/content_types/fieldable_panels_pane.inc
Small hook implementation of plugin.

File

plugins/content_types/fieldable_panels_pane.inc, line 267
CTools content type to render a fielded panel pane.

Code

function fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form($form, &$form_state) {
  $conf =& $form_state['conf'];
  if (!isset($form_state['entity'])) {
    $form_state['entity'] = fieldable_panels_panes_load_from_subtype($form_state['subtype_name']);
  }
  $entity = $form_state['entity'];

  // It's possible that we have a reference to an entity that is no longer
  // valid. If so, bail, because otherwise field API will whitescreen.
  if (empty($entity)) {
    $form['error'] = array(
      '#markup' => t('The pane entity referenced does not appear to be valid. It was probably deleted and you should remove this pane.'),
    );
    return $form;
  }
  ctools_form_include_file($form_state, $form_state['plugin']['path'] . '/' . $form_state['plugin']['file']);
  $entity_info = entity_get_info('fieldable_panels_pane');

  // Show all of the available view modes.
  foreach ($entity_info['view modes'] as $mode => $option) {
    $view_mode_options[$mode] = $option['label'];
  }
  $form['view_mode'] = array(
    '#title' => t('View mode'),
    '#type' => 'select',
    '#description' => t('Select a view mode for this pane.'),
    '#options' => $view_mode_options,
    '#default_value' => $conf['view_mode'],
  );

  // If we're adding a reusable type, the only thing we want on the form is
  // the view mode, so skip the rest.
  if ($form_state['op'] == 'add' && !empty($form_state['subtype']['entity_id'])) {
    $form_state['no update entity'] = TRUE;
    return $form;
  }
  $form = fieldable_panels_panes_entity_edit_form($form, $form_state);
  $form['reusable']['warning'] = array(
    '#markup' => '<div class="description">' . t('Note: Editing any value on a reusable pane will change the value everywhere this pane is used.') . '</div>',
  );
  return $form;
}