Field::setRoles() method

Set the roles that are allowed to view or edit this field on pages.

Applicable only if the Field::flagAccess is set to this field's flags.

Usage

$field->setRoles(string $type, $roles);

Arguments

NameType(s)Description
$typestring

Must be either "view" or "edit"

$rolesPageArray array null

May be a PageArray of Role objects or an array of Role IDs.

Exceptions

Method can throw exceptions on error:

  • WireException - if given invalid argument


$field methods and properties

API reference based on ProcessWire core version 3.0.251