The "link to user" option in the Mail Field does not shown all options. You could only decide between a link to the user and render as mailto link. But the option "no link" is hidden. The reason is because in the option_form function of the field handler, the parent method is called after we add the option "link_to_user". If we change this, we see the option and then it works.

In file ./views/modules/user/views_handler_field_user_mail.inc has to be changed from:

<?php
  function options_form(&$form, &$form_state) {
    $form['link_to_user'] = array(
      '#title' => t('Link this field'),
      '#type' => 'radios',
      '#options' => array(
        0 => t('No link'),
        'user' => t('To the user'),
        'mailto' => t("With a mailto:"),
      ),
      '#default_value' => $this->options['link_to_user'],
    );
    parent::options_form($form, $form_state);
  }
?>

to

<?php
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
  	$form['link_to_user'] = array(
      '#title' => t('Link this field'),
      '#type' => 'radios',
      '#options' => array(
        0 => t('No link'),
        'user' => t('To the user'),
        'mailto' => t("With a mailto:"),
      ),
      '#default_value' => $this->options['link_to_user'],
    );
    
  }
?>
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs work

Can you please provide a real path? It's much easier to understand what's going on

hunziker’s picture

FileSize
11.35 KB
11.05 KB

Sure, here is it:

  1. Add a View with base relation "user".
  2. Add mail field.
  3. Without patch: There you can only select if you want to link the mail address with the user. So you could only select between the linking with mailto or with the user profile site. See screenshot #1.
  4. With patch (see screenshot #2) you can select between the three cases: no link, link with mailto and link with the profile site.

I hope this clarify what I mean.

hunziker’s picture

Status: Needs work » Active
hunziker’s picture

Any update on this?

dawehner’s picture

Everytime you do an status update a kitten is killed.

merlinofchaos’s picture

Sorry, dereine typo'd his request. dereine meant to ask for a real patch. See the drupal.org resources for creating patches.

We need patch files in order to evaluate changes. It is very difficult to scan two pieces of code, side by side, and see exactly what is different.

hunziker’s picture

FileSize
804 bytes

With the risk of killing some other kitten, I will add my "path" (aka patch).

dawehner’s picture

Status: Active » Fixed

Patch looks fine, thanks!

In general it's helpful if you set the status of an issue to "needs review" once it has a patch.

Commited the patch to 7.x-3.x

hunziker’s picture

I will do so this in future. Thanks for committing.

Status: Fixed » Closed (fixed)

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

hunziker’s picture

Status: Closed (fixed) » Active

The commit get lost in the latest dev version of views. Please recommit it.

hunziker’s picture

Status: Active » Closed (fixed)

Sorry I'm wrong. I mix it up with a old version.