Created
June 21, 2014 12:36
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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