Skip to content

Instantly share code, notes, and snippets.

@batandwa
Created June 21, 2014 12:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batandwa/b07d59ae8595a815e202 to your computer and use it in GitHub Desktop.
Save batandwa/b07d59ae8595a815e202 to your computer and use it in GitHub Desktop.
Drupal 7 - Expose the machine names of permissions when viewing the permission table
// Go through each of the rows on the permissin table
rows = jQuery('#permissions tr');
rows.each(function() {
// Get the first checkbox in the row.
checkbox = jQuery('.checkbox .form-checkbox', this).first();
// Get the first cell, containing the permission label.
nameCell = jQuery('td:first-child', this);
// In case this is not a permission row
if(checkbox.length == 0) {
return;
}
// Embed the permission maching name on permission label cell.
nameCell.append("<div><code>" + checkbox.val() + "</code></div>");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment