Return all fields that have the given $tag
Returns an associative array of ['field_name' => 'field_name']
if $getFieldNames
argument is true, or ['field_name => Field instance]
if not (which is the default).
Available since version 3.0.106.
Usage
// basic usage
$array = $fields->findByTag(string $tag);
// usage with all arguments
$array = $fields->findByTag(string $tag, bool $getFieldNames = false);
Arguments
Name | Type(s) | Description |
---|---|---|
tag | string | Tag to find fields for |
getFieldNames (optional) | bool | If true, returns array of field names rather than Field objects (default=false). |
Return value
array
Array of Field objects, or array of field names if requested. Array keys are always field names.
$fields methods and properties
API reference based on ProcessWire core version 3.0.236