You are here

function sharerich_node_type_callback in Sharerich 7

Same name and namespace in other branches
  1. 7.3 sharerich.module \sharerich_node_type_callback()
  2. 7.2 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 246

Code

function sharerich_node_type_callback(&$form, &$form_state) {
  $entity_type = $form['#node_type']->type;
  $var_name = 'sharerich_node_' . $form_state['values']['type'];
  $var_get = variable_get($var_name);
  $form_value = $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($var_get) && $form_value == 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($var_name, $form_value);
  field_info_cache_clear();
}