hello,
it's possilbe to hide the field "type of publication" in the node view?

Comments

rjerome’s picture

The short answer is no, not directly like other fields.

The longer answer is... if you wanted to override the theme_biblio_tabular($variables) theme function you could, since the Publication type and Title are more or less hard coded into that theme function.

gofriller’s picture

thank's, override the theme function was the better way.

Abelito’s picture

Issue summary: View changes

Here is how I used the theme override (thought it may help others.)
Note: I'm using the Tabular View
I added this to my template.php (copied from the module biblio/includes/biblio_theme.inc), and modified
- commented out two fields that are build in (see /***)
- added an elseif to skip any fields that I didnt want displayed (see //***)

/**
 * @param $node
 * @param $base
 * @param $teaser
 * @return unknown_type
 */
function responsive_biblio_tabular($variables) {
  module_load_include('inc', 'biblio', '/includes/biblio.contributors');
  $node = $variables['node'];
  $base = $variables['base'];
  static $citeproc;

  if (module_exists('popups')) {
     popups_add_popups();
  }
  $tid = $node->biblio_type;
  $fields = _biblio_get_field_information($node->biblio_type, TRUE);
  
/*** - commented out so this field wont show on biblio nodes  
  $rows[] = array(
    array('data' => t('Title'), 'class' => array('biblio-row-title')),
    array('data' => filter_xss($node->title, biblio_get_allowed_tags()))
  );
*/
  if (!isset($node->biblio_type_name) && isset($node->biblio_type)) { // needed for preview
    if (($pub_type = db_query('SELECT t.tid, t.name FROM {biblio_types} as t WHERE t.tid=:tid', array(':tid' => $node->biblio_type))->fetchObject())) {
      $node->biblio_type_name = drupal_ucfirst(_biblio_localize_type($pub_type->tid, $pub_type->name));
    }
  }
/*** - commented out so this field wont show on biblio nodes
  $rows[] = array(
    array('data' => t('Publication Type'), 'class' => array('biblio-row-title')),
    array('data' => $node->biblio_type_name)
  );
*/

  $attrib = (variable_get('biblio_links_target_new_window', FALSE)) ? array('target' => '_blank') : array();

  $doi = '';
  if (!empty($node->biblio_doi)) {
    $doi_url = '';
    if ( ($doi_start = strpos($node->biblio_doi, '10.')) !== FALSE) {
      $doi = substr($node->biblio_doi, $doi_start);
      $doi_url .= 'http://dx.doi.org/' . $doi;
      $doi = l($doi, $doi_url, $attrib);
    }

  }

  foreach ($fields as $key => $row) {
    // handling the contributor categories like any other field orders them correctly by weight
    if ($row['type'] == 'contrib_widget' && ($authors = biblio_get_contributor_category($node->biblio_contributors, $row['fid']))) {
      $data = biblio_format_authors($authors);
    }
    elseif (empty ($node->$row['name']) || $row['name'] == 'biblio_coins') {
      continue;
    }
 //*** - Added this elseif to exclude any fields we dont want.
    elseif ($row['name'] == 'biblio_year' || $row['name'] == 'biblio_keywords' || $row['name'] == 'biblio_pages') {
      continue;
    }
    else {
      switch ($row['name']) {
        case 'biblio_keywords' :
         $data = _biblio_keyword_links($node->$row['name'], $base);
          break;
        case 'biblio_url' :
          $data = l($node->$row['name'], $node->$row['name'], $attrib);
          break;
        case 'biblio_doi' :
           $data = $doi;
          break;
        default:
          if ($row['type'] == 'text_format') {
            $format = filter_default_format();
            if (!empty($node->biblio_formats) ) {
              $formats = $node->biblio_formats;
              $format  = isset($formats[$row['name']]) ? $formats[$row['name']] : $format;
            }
            $data = check_markup($node->$row['name'], $format);
          }
          else {
            $data = check_plain($node->$row['name']);
          }
      }
    }
    $rows[] = array(
      array(
        'data' => t($row['title']),
        'class' => array('biblio-row-title')
      ),
      array(
        'data' => $data
      )
    );
  }
  if (isset($node->body) && !empty($node->body) && user_access('view full text')) {
    // Store this in a temp variable to avoid a pass-by-reference error.
    $full_text = field_view_field('node', $node, 'body', array('label' => 'hidden'));
    $rows[] = array(
        array('data' => t('Full Text'),  'valign' => 'top'),
        array('data' => drupal_render($full_text)),
    );

  }
  // let other modules add rows if desired...
  drupal_alter('biblio_node_table_rows', $rows, $node);

  $output = '<div id="biblio-node">';
  $output .= filter_xss($node->biblio_coins, array('span'));
  $header = array();
  $output .= theme('table', array('header' => $header, 'rows' => $rows));
  $output .= '</div>';

  return $output;
}
Liam Morland’s picture

Status: Active » Fixed

If you need further help, please re-open and provide details.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.