HTML for link to the legal page is not overridable (at least not in a way I could find).

Attached a simple patch (my first) to move the html link in to a theme function.

Comments

rooby’s picture

Good first patch, just one note:

+++ b/legal.module
+++ b/legal.module
@@ -107,6 +107,7 @@ function legal_theme() {

@@ -107,6 +107,7 @@ function legal_theme() {
     'legal_display' => array('variables' => array('form' => NULL)),
     'legal_page' => array('render element' => 'form'),
     'legal_login' => array('render element' => 'form'),
+    'legal_accept_label' => array('render_element' => NULL),
   );
 }

Should be:
+ 'legal_accept_label' => array('variables' => array()),

If you look at http://api.drupal.org/api/drupal/modules--system--system.api.php/functio... the first paragraph in the 'Return value' section outlines the usage of 'render element' and 'variables', but basically render element is for elements like form elements and forms etc. and variables is for your ordinary theme functions.

Another thing is to make sure to set the issue 'Status' to 'needs review', otherwise it is less likely to get people looking at it.

rooby’s picture

Category: task » feature
Status: Active » Needs review
StatusFileSize
new1.77 KB

Here is a slightly different version of the patch that allows also for when using the page link option and the accept label has a link in it.

This is useful for modifying the link in that case so it can open in colorbox or other similar things.

rooby’s picture

Sorry, I had my wires crossed a little in my last post.

The difference is it also allows for themeing of the accept label in the case that it doesn't contain the link.

hendroutomo’s picture

hi rooby, i've applied your patch,...and then what? any hint or snippet ? i need to make the legal link to view on colorbox.

rooby’s picture

I don't remember off the top of my head what I did for that.

From the colorbox readme:

Load content in a Colorbox:
---------------------------
Check the "Enable Colorbox load" option in Colorbox settings.
This enables custom links that can open content in a Colorbox.
Add the class "colorbox-load" to the link and build the url like
this "[path]?width=500&height=500&iframe=true"
or "[path]?width=500&height=500" if you don't want an iframe.

Other modules may activate this for easy Colorbox integration.

So something like this in your template.php file in your theme (note that this is untested just me typing into the comment field so there could be typos):

<?php
/**
 * Theme the accept terms and conditions label.
 *
 * @param $variables
 *   An associative array of variables for themeing, containing:
 *    - link: Whether or not the label contains a link to the legal page.
 *
 * @ingroup themeable
 */
function MYTHEME_legal_accept_label($variables) {
  if ($variables['link']) {
    $query = array(
      'width' => 500, // The width of the colorbox iframe.
      'height' => 500, // The height of the colorbox iframe.
      'iframe' => 'true',
    );
    return t('<strong>Accept</strong> <a href="@terms" class="colorbox-load">Terms & Conditions</a> of Use', array('@terms' => url('legal', array('query' => $query))));
  }
  else {
    return t('<strong>Accept</strong> Terms & Conditions of Use');
  }
}
?>

The differences are the query and the class on the link.

Then make sure to enable the "Enable Colorbox load" option in Colorbox settings.

muschpusch’s picture

Status: Needs review » Reviewed & tested by the community

The patch is simple and works! Reviewed and +1 for commiting this

hendroutomo’s picture

thanks rooby, i got it working somehow

robert castelo’s picture

Status: Reviewed & tested by the community » Fixed

Thanks rooby, and pau1_m, added to dev and will be in the next release.

Status: Fixed » Closed (fixed)

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