function readmorecontrol_entity_behaviour in Read More Control 7
Helper function to determine the Read more link behaviour.
1 call to readmorecontrol_entity_behaviour()
- readmorecontrol_entity_view in ./
readmorecontrol.module  - Extract, update or construct the read more link.
 
File
- ./
readmorecontrol.module, line 206  - Defines options to control how the Read more link is displayed on teasers.
 
Code
function readmorecontrol_entity_behaviour($entity_type, $bundle, $view_mode) {
  // This blocks all processing within entity_view().
  if (in_array($view_mode, readmorecontrol_excluded_view_modes())) {
    // Defaulting to none rather than never to prevent any additional processing.
    return 'none';
  }
  else {
    $node_teaser = $entity_type == 'node' && $view_mode == 'teaser';
    $behaviour = variable_get("readmorecontrol_behaviour__{$entity_type}__{$bundle}__{$view_mode}", $node_teaser ? 'default' : 'none');
    if ($behaviour == 'default') {
      $behaviour = variable_get("readmorecontrol_behaviour__{$entity_type}__{$bundle}", 'default');
      if ($behaviour == 'default') {
        $system_default = $node_teaser ? 'always' : 'none';
        $behaviour = variable_get("readmorecontrol_behaviour__{$entity_type}", $system_default);
      }
    }
    return $behaviour;
  }
}