views links as images?

Events happening in the community are now at Drupal community events on www.drupal.org.
keesee's picture

Hello,

I have a quick question regarding php and how views links are built. Here is the edit link code below. (views/modules/views_node.inc) How would I insert an image instead to say /modules/views images/edit.png? I'd love to add it as an option but it would conflict with the ability to enter the text you see on the front end. If someone would give me some assistance, I'd love to apply it where ever possible - view, comment, delete, edit etc... and contribute it back. I am new to php and eager to learn.


            'edit' => array(
        'name' => t('Node: Edit link'),
        'handler' => array(
          'views_handler_node_edit_destination'   => t('Return To View'),
          'views_handler_node_edit' => t('Return to Node')
        ),
        'notafield' => TRUE,
        'addlfields' => array('type', 'uid'),
        'option' => 'string',
        'help' => t('Display a link to edit the node. Enter the text of this link into the option field; if blank the default "Edit" will be used.'),
      ),

  /**
* display a link to edit a node
*/
function views_handler_node_edit($fieldinfo, $fielddata, $value, $data) {
  // try to build a fake node object
  $data->type = $data->node_type;
  $data->uid = $data->node_uid;
    return l($link_text, "node/$data->nid/edit");
  }

Thank you.

J.

Comments

Just create a new handler on

merlinofchaos's picture

Just create a new handler on a dummy table that does your image.

Sweet! Thx!

keesee's picture

Trying it out!.

J.

Whoa. hang on, that sounds

sime's picture

Whoa. hang on, that sounds like a frighteningly simple solution to a problem I shelved a few weeks ago. Mind you I wouldn't be surprised given that merlinofchaos seems to have a knack of thinking of everything.

CorpX can you please post your solution when done? Would be great to refer back here when I tackle it again.

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: