[themes] forward module link themeing
Bibleinfo.com - Design
design at bibleinfo.com
Wed Jan 24 05:04:16 UTC 2007
Mark,
While playing with the Forward.module a few months ago, I wrote a
patch to create a forward block that will do the forward
functionality straight from the page but as a block, and not inline
so the user never has to leave the page.
The patch file is at http://drupal.org/node/93499 in the issue queue
but has not been committed.
Hopefully that is something that will be useful for someone.
Brent
On Jan 22, 2007, at 11:20 AM, Mark Hope wrote:
> I'm using the forward module that adds an 'email this page/node type'
> link to nodes.
>
> I'd like to remove the link from the $link output and instead insert
> the code into a block so I can make more of a feature of it.
>
> the code from the module that generates the link:
>
> /**
> * Generate links for pages
> */
> function forward_link($type, $node=0, $main=0) {
> if (user_access('access forward') &&
> (variable_get('forward_form_type', 'link') == "link") &&
> variable_get('forward_display_'. $node->type, '1')){
> $links=array();
> if (($type == 'system')) {
> // URL, page title, func called for page content, arg, 1 = don't
> disp menu
> menu('forward', t('email this page'), 'forward_page', 1, 1);
> }
>
> // This var is set in the settings section under the
> admin/modules/forward section
> // It shows 'email this $nodetype' or 'email this page'
> $forward_link_type = variable_get('forward_link_type', 0);
> if ($forward_link_type) {
> if ($type == 'comment') {
> $forward_link_type = 'comment';
> $links[] = l(t("email this %type", array('%type' =>
> $forward_link_type)), "forward/$node->nid&cid=$node->cid",
> array('title' => t('Forward this page to a friend'), 'class' =>
> 'forward-page'));
> return $links;
> }
> $forward_link_type = $node->type;
> }
> else $forward_link_type = 'page';
>
> if (!$main || variable_get('forward_show_on_main', 0)) {
> $links[] = l(t("email this %type", array('%type' =>
> $forward_link_type)), "forward/$node->nid", array('title' => t
> ('Forward
> this page to a friend'), 'class' => 'forward-page'));
> return $links;
> }
> }
> }
>
> PHP disclaimer "I'm a designer" :-)
>
> The code I have in my block (that doesn't work):
> <?php
> global $user;
> if (user_access('access forward') && variable_get('forward_display_'.
> $node->type, '1')){
> print l("Email this page to a friend",'forward/'.$node->nid);
> }
> ?>
>
> This just gives a (/forward) url instead of passing the $nid (eg
> /forward/24)
>
> Regards
> Mark
>
> _______________________________________________
> themes mailing list
> themes at drupal.org
> http://lists.drupal.org/mailman/listinfo/themes
More information about the themes
mailing list