I'm not sure this is possible outside of editing the module itself and adding classes to these links, however what I would like is for these links to be icons rather than text as on ht eporject I am working on, space is limited so icons would work better for me. I'm sure I can edit the module to do this myself, but thought there might be an easier way to add classes to these links and remove the text?

Comments

jeremymcminn’s picture

I assume it is to do with this code here on webform.components.inc - not sure how to adda different class to the edit, clone or delete links though

$row_data = array(
        $indents . filter_xss($component['name']),
        t($component['type']),
        ($component['value'] == '') ? '-' : $component['value'],
        drupal_render($form['components'][$cid]['mandatory']),
        drupal_render($form['components'][$cid]['cid']) . drupal_render($form['components'][$cid]['pid']) . drupal_render($form['components'][$cid]['weight']),
        l(t('Edit'), 'node/' . $node->nid . '/webform/components/' . $cid, array('query' => drupal_get_destination())),
        l(t('Clone'), 'node/' . $node->nid . '/webform/components/' . $cid . '/clone', array('query' => drupal_get_destination())),
        l(t('Delete'), 'node/' . $node->nid . '/webform/components/' . $cid . '/delete', array('query' => drupal_get_destination())),
      );
jeremymcminn’s picture

StatusFileSize
new25.85 KB

For example purposes, this is what it would look like

jeremymcminn’s picture

This is what I did to add classes to the links

 l(t('Edit'), 'node/' . $node->nid . '/webform/components/' . $cid, array('attributes' => array('class' => 'component-edit', 'query' => drupal_get_destination()))),
        l(t('Clone'), 'node/' . $node->nid . '/webform/components/' . $cid . '/clone', array('attributes' => array('class' => 'component-clone', 'query' => drupal_get_destination()))),
        l(t('Delete'), 'node/' . $node->nid . '/webform/components/' . $cid . '/delete', array('attributes' => array('class' => 'component-delete', 'query' => drupal_get_destination()))),

Then I added the following CSS

.component-edit {

  /* Hide Text */
  text-indent: -9999px;

  display: block;
  background: url('edit_button.png') no-repeat;

  /* Set width and height equal to the size of your image */
  width: 20px;
  height: 20px;
}

The link format seems to have changed though

Rather than this link
wtresafasfasf/webform/components/1?destination=node/237/webform/components%3Fcid%3D1
it returns
wtresafasfasf/webform/components/1

Is that a problem?

jeremymcminn’s picture

StatusFileSize
new46.49 KB

This was the end result

quicksketch’s picture

You can do this by overriding theme_webform_components_form() in your theme, but that function is a monster. I'd be happy to just add these classes to the module directly (though they should probably be prefixed with "webform-").

jeremymcminn’s picture

Thanks quicksketch. I think adding the classes direct would be good, not sure if how I did it is the best way but it seems to work.

carlhinton’s picture

The webform classes module http://drupal.org/project/webform-classes allows you to add classes onto components

quicksketch’s picture

Version: 7.x-3.18 » 7.x-4.x-dev
Issue summary: View changes
Status: Active » Fixed
StatusFileSize
new4.32 KB

I've committed this patch which adds classes for the 4.x version of the module. We probably don't need a backport for this at this point.

  • Commit 39e2165 on 7.x-4.x by quicksketch:
    Issue #1591476: Ability to theme Edit, Clone and Delete links on form...
fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Fixed » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed 39e2165 to 8.x-4.x. Thanks!

  • Commit 9206201 on 8.x-4.x authored by quicksketch, committed by fenstrat:
    Issue #1591476 by quicksketch: Ability to theme Edit, Clone and Delete...

Status: Fixed » Closed (fixed)

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