Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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) {
// 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