You are here

function sharerich_node_type_callback in Sharerich 7.2

Same name and namespace in other branches
  1. 7.3 sharerich.module \sharerich_node_type_callback()
  2. 7 sharerich.module \sharerich_node_type_callback()

Custom handler to save sharerich info.

1 string reference to 'sharerich_node_type_callback'
sharerich_form_node_type_form_alter in ./sharerich.module
Implements hook_form_FORM_ID_alter().

File

./sharerich.module, line 376

Code

function sharerich_node_type_callback(&$form, &$form_state) {
  $entity_type = $form['#node_type']->type;
  $node_type = 'sharerich_node_' . $form_state['values']['type'];
  $enabled_node_type = variable_get($node_type, 0);
  $show = $form_state['complete form']['sharerich']['show']['#value'];

  // When Sharerich is enabled for the first time on this content type,
  // redirect to the display settings.
  if (empty($enabled_node_type) && $show == TRUE) {
    drupal_set_message(t('Please configure the field Sharerich for each Display.'));
    $form_state['redirect'] = 'admin/structure/types/manage/' . $entity_type . '/display';
  }
  variable_set($node_type, $show);

  // Clear cache.
  field_info_cache_clear();
}