First I have to thank you this module is saving my butt!
For my feature request, in views I'd like to be able to change the label on the field from "Parent Node" to something custom or remove it.

Comments

ronan’s picture

Status: Active » Closed (won't fix)

That should be doable in the theming layer. I'm not as familiar with the d6 theming engine as I am with the d5 one so I can;t give you a good code example, but the theme developer module (part of the devel module) should help point you in the right direction.

Since there's a workaround, and this sort of customization is usually done in the theme in Drupal, I'm going to mark this as will not fix.

Good luck
Ronan

paperfield’s picture

Thanks for the pointer I will probably not install the theme devel module as it has been noted as breaking views. I was able to add to the options_form function in the nodehierarchy.views.inc the extra form I requested plus one extra that are already implemented in views 2. Here are the changes if you are interested.

Added to nodehierarchy.views.inc in the options_form function

$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
'#description' => t('The label for this field that will be displayed to end users if the style requires it.'),
);
$form['exclude'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude from display'),
'#default_value' => $this->options['exclude'],
'#description' => t('Check this box to not display this field, but still load it in the view. Use this option to not show a grouping field in each record, or when doing advanced theming.'),
);

I'd like to give credit to the views/includes/field.handlers.inc file that this was snipped from...

ablewave’s picture

I have tried to implement this as well, but it doesn't seem to be doing the trick for me. My function now looks like (starting at line 149):

function options_form(&$form, &$form_state) {
$form['display_as'] = array(
'#title' => t('Display this field as'),
'#type' => 'select',
'#options' => array('title' => t('Node Parent Title'), 'nid' => t('Node Parent ID')),
'#default_value' => $this->options['display_as'],
);
$form['link_to_parent'] = array(
'#title' => t('Link this field to the parent node'),
'#type' => 'checkbox',
'#default_value' => $this->options['link_to_parent'],
);
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Label'),
'#default_value' => isset($this->options['label']) ? $this->options['label'] : '',
'#description' => t('The label for this field that will be displayed to end users if the style requires it.'),
);
$form['exclude'] = array(
'#type' => 'checkbox',
'#title' => t('Exclude from display'),
'#default_value' => $this->options['exclude'],
'#description' => t('Check this box to not display this field, but still load it in the view. Use this option to not show a grouping field in each record, or when doing advanced theming.'),
);
}

I have flushed the views cache, and tried to edit the properties of that field to no avail. What have I missed? I am on version 6.x-1.1.

paperfield’s picture

That is the same as my snippet in 6x1.1. I'm not sure where you are getting stopped. Here is what I've done with mine...

In views:
Add Node Hierarchy: Parent Node as a field. You should see the new options.
Set - Display this field as: Node Parent Title and check Exclude from display. You should also be able to change/remove the label.
In basic settings you will want to set the style to Table. Under settings for the style pick Node Hierarchy: Parent Node as the Grouping Field

If you are not seeing the new options at all I'm not sure what that issue is.

ablewave’s picture

Greatly appreciate you getting back to me. Still don't have the options. Care to post your revised file in its entirety? OR was there something to be done to template.php or some other file?

Thanks again...

jadakren’s picture

Version: 6.x-1.0 » 6.x-1.3
Status: Closed (won't fix) » Postponed (maintainer needs more info)

If anyone is still trying to get this to work then it is posible with version :

; $Id: nodehierarchy.info,v 1.1.4.1 2008/03/23 06:18:40 ronan Exp $
name = Node Hierarchy
description = A module to make nodes heirarchical.
package = "Node Hierarchy"
core = 6.x

; Information added by drupal.org packaging script on 2009-11-03
version = "6.x-1.3"
core = "6.x"
project = "nodehierarchy"
datestamp = "1257264998"

File : modules-folder/nodehierarchy/includes/views/views_handler_field_nodehierarchy_parent.inc
Find this function :

  /**
   * Provide link-to-comment option.
   */
  function options_form(&$form, &$form_state) {
	
    $form['display_as'] = array(
      '#title' => t('Display this field as'),
      '#type' => 'select',
      '#options' => array('title' => t('Node Parent Title'), 'nid' => t('Node Parent ID')),
      '#default_value' => $this->options['display_as'],
    );
    $form['link_to_parent'] = array(
      '#title' => t('Link this field to the parent node'),
      '#type' => 'checkbox',
      '#default_value' => $this->options['link_to_parent'],
    );

  }

Change it to this :

  /**
   * Provide link-to-comment option.
   */
  function options_form(&$form, &$form_state) {
	parent::options_form($form,$form_state);
	
    $form['display_as'] = array(
      '#title' => t('Display this field as'),
      '#type' => 'select',
      '#options' => array('title' => t('Node Parent Title'), 'nid' => t('Node Parent ID')),
      '#default_value' => $this->options['display_as'],
    );
    $form['link_to_parent'] = array(
      '#title' => t('Link this field to the parent node'),
      '#type' => 'checkbox',
      '#default_value' => $this->options['link_to_parent'],
    );

  }
ashedryden’s picture

Thanks - this worked perfectly to add the basic views field options.

derjochenmeyer’s picture

Title: custom label for field display in view » Restore default views handler options
Version: 6.x-1.3 » 6.x-1.x-dev
Category: feature » bug
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new510 bytes

The keyline in #6 is

    parent::options_form($form,$form_state);

Attachted patch restores the default handler options.

jbylsma’s picture

Component: User interface » Drupal/PHP Code
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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