Download & Extend

alinks to work in side content

Project:Alinks
Version:5.x-1.4-3
Component:User interface
Category:feature request
Priority:critical
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

I have a drupal site which hs all the content in the side content (which is in the right side bar) and images in the actual content (body) space. I desperately need to have alinks work for me in the side content. Is there anybody who has cracked this issue? I do know this is a duplicate request but I did not want to change the version in the previous request. Thanks in advance
Jaya

Comments

#1

Please let me know if there is any progress on this. I would also like to be able to use alinks in CCK fields

Thank you
Warm regards
Jaya

#2

I have a solution for Drupal 6.x (which may be applicable to 5.x?) - I think... that allows any CCK field with a field type of 'text' to be included in the areas that are searched - to insert links into.

alinks.module modified to change the 'alinks_nodeapi' function as follows;

/**
* Implementation of hook_nodeapi().
*/
function alinks_nodeapi(&$node, $op, $teaser, $page) {
 
  switch ($op) {
    case 'view':
   
      $node_types = in_array($node->type, variable_get('alinks_node_types', array()), TRUE);
     
      if ($node_types) {
        drupal_add_css(drupal_get_path('module', 'alinks').'/alinks.css');
        $words = alinks_get_strings();
      
        if ($words) {
       
          $node->content['body']['#value'] = alinks_make_links($node->content['body']['#value'], $words);

/**
*  find CCK fields (prefix of 'field_') where format == 2 (text fields) and make links on the value of the field
*/
    $cck_fields = get_object_vars($node);
foreach (array_keys($cck_fields) as $cck_field){
  if (substr($cck_field,0,6) == "field_" && $node->{$cck_field}[0]['format'] == 2){

          $node->{$cck_field}[0]['value'] = alinks_make_links($node->{$cck_field}[0]['value'], $words);
  }
}

    }
      }
      break;
  }
}

It is dependent upon the fieldnames being prefixed with 'field_' - which is the way with CCK as far as I can gather.

The only thing I am not sure about is whether the 'format' == 2 will always equate to 'text' field types or if this is dependent upon the installation/configuration of the CCK module.

Perhaps others can give feedback regarding this...?

Hope it is useful.

#3

Hi, Thanks for the detailed reply. will certainly try this out and let you know.

jaya

#4

Status:active» closed (duplicate)

Marking duplicate of #144953: Alink with CCK field?

nobody click here