I have a view where the display title of the view is a link:
<a href="/some/path">Title</a>.

I would like to be able to add the base path for the drupal installation into the url, rather than hardcoding/assuming a certain path, e.g.
<a href="[base_path]some/path">Title</a>.

Is this possible? The display title certainly allows html, but does it expose any tokens/variables that can be used?

Comments

dawehner’s picture

No this is not really possible, but you can use for example hook_preprocess_views_view or hook_views_pre_render to change this variable and use something you want there.

nasi’s picture

Thanks for the confirmation; I thought that might be the case. I'll take a look at those preprocess functions.

Would this functionality constitute a useful feature request, or is it too esoteric for coding into the system?

My use case is this: I have a block that displays the latest available newsletter, with an image that links directly to a pdf. This block is displayed in the news section. I have the block title set to 'Newsletters' and as a link that takes the user to a view showing all past & present newsletters.

I'm sure I'm not the only one this would be useful to, but without access to $base_path I have to hard-code the url to fit the installation.

dawehner’s picture

This is just my oppinion: this should be part of views core, but could be implemented in another contrib module.

nasi’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
Category: support » feature

Since I'm not alone in thinking this is a good idea, I'll change it to a feature request.

dawehner’s picture

Ups i wanted to write "this shouldn't be part of views core, but could be implemented in another contrib module".

I'm sorry.

iamjon’s picture

Status: Active » Closed (won't fix)

nasi,
I don't think it will be implemented in views. You can try moving this over to the views_bonus_pack or views_hacks module maybe they would be interested in developing it. Alternatively if you would like to code and share it as tutorial there is views_plugin_examples module
Good luck.
Closing based on issue 5. Please feel free to reopen or move to another issue queue.

teohhanhui’s picture

I would love to see this implemented. Setting page/feed titles manually gets ugly fast.