diff --git a/flexslider_fields/flexslider_fields.module b/flexslider_fields/flexslider_fields.module index 47e2289..4ee9e23 100644 --- a/flexslider_fields/flexslider_fields.module +++ b/flexslider_fields/flexslider_fields.module @@ -88,31 +88,20 @@ function flexslider_fields_field_formatter_settings_form($field, $instance, $vie } if (!empty($instance['settings'])) { - // If the image field doesn't have the Title field enabled, tell the user. - if ($instance['settings']['title_field'] == FALSE and $instance['bundle'] != 'ctools') { - $form['caption'] = array( - '#title' => t('Choose a caption source'), - '#type' => 'select', - '#disabled' => TRUE, - '#options' => array( - 0 => t('None'), - 1 => t('Image title'), - 'alt' => t('Image ALT attribute'), - ), - '#description' => t('You need to enable the Title field for this image field to be able use it as a caption.', array('@url' => url('admin/structure/types/manage/' . $instance['bundle'] . '/fields/' . $instance['field_name'], array('fragment' => 'edit-instance-settings-title-field', 'query' => array('destination' => 'admin/structure/types/manage/' . $instance['bundle'] . '/display'))))), - ); - } - else { - $form['caption'] = array( - '#title' => t('Choose a caption source'), - '#type' => 'select', - '#options' => array( - 0 => t('None'), - 1 => t('Image title'), - 'alt' => t('Image ALT attribute'), - ), - '#default_value' => $settings['caption'], - ); + $form['caption'] = array( + '#title' => t('Choose a caption source'), + '#type' => 'select', + '#options' => array( + 0 => t('None'), + 1 => t('Image title'), + 'alt' => t('Image ALT attribute'), + ), + ); + + // If the image field doesn't have the Title or ALT field enabled, tell the user. + if (($instance['settings']['title_field'] == FALSE && $instance['settings']['alt_field'] == FALSE) && $instance['bundle'] != 'ctools') { + $form['caption']['#disabled'] = TRUE; + $form['caption']['#description'] = t('You need to enable Title or Alternate text for this image field to use either as a caption.', array('@url' => url('admin/structure/types/manage/' . $instance['bundle'] . '/fields/' . $instance['field_name'], array('fragment' => 'edit-instance-settings-title-field', 'query' => array('destination' => 'admin/structure/types/manage/' . $instance['bundle'] . '/display'))))); } }