You are here

function readmorecontrol_display_options in Read More Control 7

Helper function to get the default display options.

2 calls to readmorecontrol_display_options()
readmorecontrol_admin_settings_form in ./readmorecontrol.admin.inc
Menu callback to configure the default behaviour of the module.
_readmorecontrol_form_field_ui_display_overview_form_alter in ./readmorecontrol.admin.inc
Internal implementation of hook_form_FORM_ID_alter().

File

./readmorecontrol.admin.inc, line 409
Contains form alter callback bodies.

Code

function readmorecontrol_display_options($entity_type, $bundle = NULL, $view_mode = NULL) {
  $entity_info = entity_get_info($entity_type);
  $options = array();
  if (isset($bundle)) {
    $options['default'] = t('Inherit default behaviour');
  }
  if ($entity_type == 'node') {
    $options += array(
      'always' => t('Always show link<br/><small>Standard Drupal 7 behaviour.</small>'),
      'when_required' => t('Show link when required by any supported fields'),
      'when_required_text' => t('Show link when required by any supported text based fields'),
      'when_required_body' => t('Show link when required by the Body (body) field<br/><small>Standard Drupal 6 behaviour.</small>'),
      'never' => t('Never show link'),
    );
  }
  else {
    $options += array(
      'always' => t('Add a link'),
    );
    if ($entity_info['fieldable']) {
      $options['when_required'] = t('Add link when required by any supported fields');
      $options['when_required_text'] = t('Add link when required by any supported text based fields');
    }
    $options['never'] = t('Never add link');
  }
  $options['none'] = t('Do not process');
  return $options;
}