get('field_name'); * #pw-body Field objects are managed by the `$fields` API variable. * #pw-use-constants * * ProcessWire 3.x, Copyright 2022 by Ryan Cramer * https://processwire.com * * @property int $id Numeric ID of field in the database #pw-group-properties * @property string $name Name of field #pw-group-properties * @property string $table Database table used by the field #pw-group-properties * @property string $prevTable Previously database table (if field was renamed) #pw-group-properties * @property string $prevName Previously used name (if field was renamed), 3.0.164+ #pw-group-properties * @property Fieldtype|null $type Fieldtype module that represents the type of this field #pw-group-properties * @property Fieldtype|null $prevFieldtype Previous Fieldtype, if type was changed #pw-group-properties * @property int $flags Bitmask of flags used by this field #pw-group-properties * @property-read string $flagsStr Names of flags used by this field (readonly) #pw-group-properties * @property string $label Text string representing the label of the field #pw-group-properties * @property string $description Longer description text for the field #pw-group-properties * @property string $notes Additional notes text about the field #pw-group-properties * @property string $icon Icon name used by the field, if applicable #pw-group-properties * @property string $tags Tags that represent this field, if applicable (space separated string). #pw-group-properties * @property-read array $tagList Same as $tags property, but as an array. #pw-group-properties * @property bool $useRoles Whether or not access control is enabled #pw-group-access * @property array $editRoles Role IDs with edit access, applicable only if access control is enabled. #pw-group-access * @property array $viewRoles Role IDs with view access, applicable only if access control is enabled. #pw-group-access * @property array|null $orderByCols Columns that WireArray values are sorted by (default=null), Example: "sort" or "-created". #pw-internal * @property int|null $paginationLimit Used by paginated WireArray values to indicate limit to use during load. #pw-internal * @property array $allowContexts Names of settings that are custom configured to be allowed for context. #pw-group-properties * @property bool|int|null $flagUnique Non-empty value indicates request for, or presence of, Field::flagUnique flag. #pw-internal * @property Fieldgroup|null $_contextFieldgroup Fieldgroup field is in context for or null if not in context. #pw-internal * @property true|null $distinctAutojoin When true and flagAutojoin is set, a distinct autojoin will be used. 3.0.208+ #pw-internal * * Common Inputfield properties that Field objects store: * @property int|bool|null $required Whether or not this field is required during input #pw-group-properties * @property string|null $requiredIf A selector-style string that defines the conditions under which input is required #pw-group-properties * @property string|null $showIf A selector-style string that defines the conditions under which the Inputfield is shown #pw-group-properties * @property int|null $columnWidth The Inputfield column width (percent) 10-100. #pw-group-properties * @property int|null $collapsed The Inputfield 'collapsed' value (see Inputfield collapsed constants). #pw-group-properties * @property int|null $textFormat The Inputfield 'textFormat' value (see Inputfield textFormat constants). #pw-group-properties * * @method bool viewable(Page $page = null, User $user = null) Is the field viewable on the given $page by the given $user? #pw-group-access * @method bool editable(Page $page = null, User $user = null) Is the field editable on the given $page by the given $user? #pw-group-access * @method Inputfield getInputfield(Page $page, $contextStr = '') Get instance of the Inputfield module that collects input for this field. * @method InputfieldWrapper getConfigInputfields() Get Inputfields needed to configure this field in the admin. * * @todo add modified date property * */ class Field extends WireData implements Saveable, Exportable { /** * Field should be automatically joined to the page at page load time * * #pw-group-flags * */ const flagAutojoin = 1; /** * Field used by all fieldgroups - all fieldgroups required to contain this field * * #pw-group-flags * */ const flagGlobal = 4; /** * Field is a system field and may not be deleted, have it's name changed, or be converted to non-system * * #pw-group-flags * */ const flagSystem = 8; /** * Field is permanent in any fieldgroups/templates where it exists - it may not be removed from them * * #pw-group-flags * */ const flagPermanent = 16; /** * Field is access controlled * * #pw-group-flags * */ const flagAccess = 32; /** * If field is access controlled, this flag says that values are still front-end API accessible * * Without this flag, non-viewable values are made blank when output formatting is ON. * * #pw-group-flags * */ const flagAccessAPI = 64; /** * If field is access controlled and user has no edit access, they can still view in the editor (if they have view permission) * * Without this flag, non-editable values are simply not shown in the editor at all. * * #pw-group-flags * */ const flagAccessEditor = 128; /** * Field requires that the same value is not repeated more than once in its table 'data' column (when supported by Fieldtype) * * When this flag is set and there is a non-empty $flagUnique property on the field, then it indicates a unique index * is currently present. When only this flag is present (no property), it indicates a request to remove the index and flag. * When only the property is present (no flag), it indicates a pending request to add unique index and flag. * * #pw-group-flags * @since 3.0.150 * */ const flagUnique = 256; /** * Field has been placed in a runtime state where it is contextual to a specific fieldgroup and is no longer saveable * * #pw-group-flags * */ const flagFieldgroupContext = 2048; /** * Set this flag to override system/permanent flags if necessary - once set, system/permanent flags can be removed, but not in the same set(). * * #pw-group-flags * */ const flagSystemOverride = 32768; /** * Prefix for database tables * * #pw-internal * */ const tablePrefix = 'field_'; /** * Permanent/native settings to an individual Field * * id: Numeric ID corresponding with id in the fields table. * type: Fieldtype object or NULL if no Fieldtype assigned. * label: String text label corresponding to the