function hashtags_fields_content_types_submit in Hashtags 7
1 string reference to 'hashtags_fields_content_types_submit'
- hashtags_configuration_form in ./
hashtags.module - Hashtags configuration form
File
- ./
hashtags.module, line 1022
Code
function hashtags_fields_content_types_submit($form, &$form_state) {
if ($form_state['clicked_button']['#parents'][0] == 'submit') {
$field_name = variable_get('hashtags_terms_field', '');
foreach ($form_state['values']['hashtags_content_types'] as $content_type => $checked) {
$instance = field_info_instance('node', $field_name, $content_type);
if ($content_type === $checked) {
if (!is_array($instance)) {
$instance = array(
'field_name' => $field_name,
'entity_type' => 'node',
'label' => 'Hashtags',
'bundle' => $content_type,
'widget' => array(
'type' => 'taxonomy_autocomplete',
'weight' => -4,
),
'display' => array(
'default' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
'teaser' => array(
'type' => 'taxonomy_term_reference_link',
'weight' => 10,
),
),
);
field_create_instance($instance);
}
}
else {
if (is_array($instance)) {
field_delete_instance($instance, FALSE);
}
}
}
// activate hashtags for Body field for selected content types
hashtags_fields_activate();
drupal_set_message(t('Content types and Hashtags fields chain have been saved.'));
}
}