Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

DrawOption()

Description

Renders an option in the Permission Manager (admin_group_permissions.php page)

Parameters

ColumnTypeDefaultDescription
$permission string Permission identifier
$description string User friendly description of the permission
$reverse boolean false Reverse the permission
$reload boolean false deprecated - Autosave changes done on this permission
$disabled boolean false: void { global $permissions Disable this permission as another supersedes it (greys it out and checks it)
$permissions;

Location

include/render_functions.php lines 4990 to 5030

Definition

 
function DrawOption(string $permissionstring $descriptionbool $reverse falsebool $reload falsebool $disabled false): void
    
{
    global 
$permissions,$permissions_done;

    
$description_escaped strip_paragraph_tags(strip_tags_and_attributes($description));
    
    
$checked in_array($permission$permissions);
    if (
$reverse)
        {
        
$checked = !$checked;
        }
    
    
$input_value $reverse "reverse" "normal";
    
$base64_perm base64_encode($permission);

    
// Other attributes - note: a disabled input also gets checked automatically (some plugins do it)
    
$disabled_attr '';
    
$onchange_attr " onchange=SavePermissions(['$base64_perm']);";
    if (
$disabled)
        {
        
$checked true;
        
$disabled_attr ' disabled';
        
$onchange_attr '';
        }
    
$checked_attr $checked ' checked' '';
    
?>
    <input type="hidden" name="permission_ echo $base64_perm?>" value=" echo $input_value?>">
    <tr>
    <td> if ($reverse) {?><i> ?> echo escape($permission?> if ($reverse) {?></i> ?></td>
        <td> echo $description_escaped?></td>
        <td>
            <input
                type="checkbox"
                name="checked_ echo $base64_perm?>"
                data-reverse=" echo (int) $reverse?>"
                 echo $disabled_attr $checked_attr $onchange_attr?>>
        </td>
    </tr>
    
    $permissions_done
[] = $permission;
    }

This article was last updated 22nd May 2024 15:05 Europe/London time based on the source file dated 17th May 2024 16:45 Europe/London time.