fields
object
%field
/phlo/resources/fields/field.phlo
function
function field ($type, ...$args)
line 10
Creates a field with a specified type and additional arguments, using the phlo function to generate a unique identifier for the field.
phlo("field_$type", ...$args, type: $type)static
field :: __handle
line 12
This property is used to access the internal handle of a field object in Phlo.
nullprop
%field -> title
line 14
This expression retrieves the 'name' property of the current object, capitalizing the first letter.
ucfirst($this->name)method
%field -> input ($record)
line 16
Generates an input field based on the specified type, name, and value from the provided record, with optional attributes for maxlength and placeholder.
input(type: $this->type, name: $this->name, value: $record->{$this->name} ?? $this->default, maxlength: $this->length, placeholder: $this->placeholder, class: 'field')method
%field -> label ($record)
line 17
Retrieves the label of a field from the specified record using the field's name.
$record->{$this->name};prop
%field -> objColumns
line 19
This property retrieves the columns of the specified obj in the context of a field.
[]method
%field -> objValidate ($value)
line 21
Validates the given value against specified rules such as required, length, pattern, and enumeration constraints, returning error messages if validation fails.
if (($value === null || $value === void) && $this->required) return $this->title.' is required'
if ($value === null || $value === void) return null
if ($this->length && is_string($value) && mb_strlen($value) > $this->length) return $this->title.' is too long (max '.$this->length.')'
if ($this->pattern && is_string($value) && !preg_match('/'.str_replace('/', '\\/', $this->pattern).'/', $value)) return $this->title.' has invalid format'
if ($this->enum && !in_array($value, (array)$this->enum, true)) return $this->title.' must be one of: '.implode(', ', (array)$this->enum)
return nullobject
%field_bool
/phlo/resources/fields/bool.phlo
prop
%field_bool -> true
line 11
Represents a boolean field with a true value, displayed as a checkmark symbol '✅'.
'✅'prop
%field_bool -> false
line 12
Represents a boolean field with a default value of false, displayed as '❌'.
'❌'method
%field_bool -> label ($record)
line 14
Returns the label corresponding to a boolean field in the given record, returning either the true label or the false label based on the field's value.
$record->{$this->name} ? $this->true : $this->falsemethod
%field_bool -> input ($record)
line 15
Generates a checkbox input field for a boolean value, with a label, based on the provided record's value.
tag('label', inner: input(type: 'checkbox', name: $this->name, value: 1, checked: $record->{$this->name} ? false : null).tag('span', class: 'slider', inner: void))method
%field_bool -> parse ($record)
line 16
Parses a boolean value from the payload and assigns it to the specified field in the record.
$record->{$this->name} = (bool)%payload->{$this->name};method
%field_bool -> nullable
line 17
This function converts a boolean field to a nullable type, allowing it to represent true, false, or null values.
falseprop
%field_bool -> objColumns
line 19
Accesses the column associated with the boolean field in the object context.
[$this->name]object
%field_child
/phlo/resources/fields/child.phlo
prop
%field_child -> list
line 11
Accesses the 'count' property of the field_child object within the list.
'count'prop
%field_child -> change
line 12
The field_child->$change property indicates whether the child field has undergone any changes, with a boolean value of false meaning no changes have occurred.
falseprop
%field_child -> create
line 13
This expression evaluates to false, indicating that the field_child property does not support the create operation.
falseprop
%field_child -> record
line 14
Accesses the child record of the current field in a list.
'list'method
%field_child -> count ($record)
line 16
Counts the number of child records associated with the given record and returns the count.
tag('a', href: slash.($record::$uriRecord ?? $record::class).slash.$record->id.slash.$this->name, class: 'async', inner: $record->getCount($this->name).space.$this->title)method
%field_child -> last ($record)
line 17
Retrieves the last value of the specified field from the given record.
$record->getLast($this->name)method
%field_child -> label ($record)
line 18
Retrieves the label for a child field from a given record, returning a dash if no label is found.
implode(loop($record->{$this->name}, fn($child) => $this->link($child))) ?: dashmethod
%field_child -> input ($record)
line 19
Generates an input field associated with a specific record, utilizing the label method to display the corresponding label.
$this->label($record)method
%field_child -> link ($record)
line 20
Generates an anchor (`<a>`) element linking to a resource identified by the given `$record`, using its URI and ID, and applies the 'async' class for asynchronous loading.
tag('a', href: slash.($record::$uriRecord ?? $record::class).slash.$record->id, class: 'async', inner: $record)object
%field_date
/phlo/resources/fields/date.phlo
prop
%field_date -> handle
line 11
This expression retrieves the handle associated with the field_date object, returning true if it exists.
trueprop
%field_date -> objColumns
line 13
Accesses the date field of the specified object columns using the name property.
[$this->name]object
%field_datetime
/phlo/resources/fields/datetime.phlo
prop
%field_datetime -> handle
line 11
The field_datetime->$handle expression is used to access the handle of a datetime field in Phlo.
trueprop
%field_datetime -> change
line 12
This item checks if the field name is not 'created' or 'changed' before allowing a change to the datetime field.
!in_array($this->name, ['created', 'changed'])prop
%field_datetime -> create
line 13
Checks if the field name is not 'created' or 'changed'.
!in_array($this->name, ['created', 'changed'])method
%field_datetime -> label ($record)
line 15
Generates a label for a datetime field in a record, displaying an icon and a human-readable time format if a value exists.
($value = $record->{$this->name}) ? tag('i', class: 'icon clock-'.$this->labelIconClass(time() - $value), inner: void).tag('span', data_ts: $record->{$this->name}, inner: time_human($record->{$this->name})) : dashmethod
%field_datetime -> labelIconClass ($value)
line 16
Returns a color class based on the value of time in seconds, categorizing it as 'red' for more than a day, 'yellow' for more than an hour, and 'blue' for less.
$value > 86400 ? 'red' : ($value > 3600 ? 'yellow' : 'blue')method
%field_datetime -> input ($record)
line 17
Generates an input field of type 'datetime-local' for a specified record, pre-filled with the formatted date and time value.
input(type: 'datetime-local', name: $this->name, value: date('Y-m-d\TH:i', $record->{$this->name}), class: 'field')method
%field_datetime -> parse ($record)
line 18
Parses a datetime field from a record, setting 'created' to the current time if it is not already set, updating 'changed' to the current time, or converting a payload value to a timestamp if it exists.
if ($this->name === 'created') $record->created ??= time()
elseif ($this->name === 'changed') $record->{$this->name} = time()
elseif ($payload = %payload->{$this->name}) $record->{$this->name} = strtotime($payload)prop
%field_datetime -> objColumns
line 24
Accesses the column associated with the field_datetime object, returning its name.
[$this->name]object
%field_email
/phlo/resources/fields/email.phlo
view
%field_email -> label ($record)
line 12
This view generates a mailto link for an email address stored in the record, allowing users to click and send an email directly.
<a href="mailto:{{ $record->{$this->name} }}">{{ $record->{$this->name} }}</a>object
%field_file
/phlo/resources/fields/file.phlo
prop
%field_file -> canDelete
line 11
The `field_file->$canDelete` property indicates whether the file can be deleted.
trueprop
%field_file -> delete
line 12
Prompts the user for confirmation before deleting a file.
'Delete file?'prop
%field_file -> path
line 13
The `field_file->$path` retrieves the file path associated with a specific file field in the context of a resource.
filesprop
%field_file -> uri
line 14
This property returns the URI for a file stored in the '/files/' directory.
'/files/'prop
%field_file -> length
line 15
The `$length` property of `field_file` returns the size of the file in bytes.
100method
%field_file -> label ($record)
line 17
Generates a hyperlink for a file associated with the given record, using the file's name and a token for secure access. If no file is present, it returns a dash symbol.
($filename = $record->{$this->name}) ? tag('a', href: $this->uri.$record->{$this->name.'_token'}.slash.rawurlencode($filename), target: 'file', inner: tag('i', class: 'icon '.pathinfo($filename, PATHINFO_EXTENSION), inner: void).$filename) : dashmethod
%field_file -> input ($record)
line 18
Generates an HTML input field for file uploads, displaying the current file name if available and providing an option to delete the file.
$input = void
$file = ($filename = $record->{$this->name}) ? $this->read($record) : null
$input .= lf.tab.tag('div', class: 'file', inner: $file ? tag('i', class: "icon $file->ext", inner: void).$filename : '-select-')
$input .= lf.tab.input(type: 'file', class: 'file-input', name: $this->name, accept: '.pdf')
$file && $this->canDelete && $input .= lf.tab.tag('div', inner: tag('label', inner: input(type: 'checkbox', name: $this->name.'Delete')." $this->delete"))
return $input.lfmethod
%field_file -> parse ($record)
line 27
Parses a file from the payload, handling deletion and writing the file if valid, and updates the record with the file's shortened name and token.
$file = %payload->{$this->name};
if ($delete = %payload->{$this->name.'Delete'}) unset(%payload->{$this->name.'Delete'})
if ($record->{$this->name} && $delete && $this->canDelete) $record->{$this->name} = $record->{$this->name.'_token'} = null
if (is_a($file, 'file')){
$token = $file->token
if (!$this->write($file)) return
$record->{$this->name} = $file->shortenTo($this->length)
$record->{$this->name.'_token'} = $token
}method
%field_file -> read ($record, $path = null)
line 39
Reads a file associated with a record, using a specified path or a default path, and returns the file's content along with its name and additional information.
$filename = $record->{$this->name};
$token = $record->{$this->name.'_token'};
return %file(($path ?? $this->path).($info = substr($token, 0, 2).slash.substr($token, 2).dot.pathinfo($filename, PATHINFO_EXTENSION)), name: $filename, info: $info)method
%field_file -> write ($file)
line 45
Writes the specified file to the designated path, moving it if necessary, and triggers an error if the write operation fails.
file_exists($dest = $this->writePath($file)) || $file->move($dest) || error("Couldn't write: $dest")method
%field_file -> writePath ($file, $path = null)
line 46
Writes the file to a specified path, creating the directory if it does not exist, and returns the full path of the written file.
$token = $file->token
$path = ($path ?? $this->path).substr($token, 0, 2)
is_dir($path) || mkdir($path) || error("Couldn't create: $path")
return $path.slash.substr($token, 2).dot.$file->extprop
%field_file -> objColumns
line 53
This property retrieves an array containing the name of the field and its associated token for the specified object columns.
[$this->name, $this->name.'_token']view
script
line 55
This script handles file input interactions by triggering a click on the file input when the associated label is clicked and updates the label text with the selected file name upon file selection.
on('click', '.input.file .file', (file) => file.nextElementSibling.click())
on('change', '.input.file .file-input', (input) => input.previousElementSibling.innerText = input.files[0].name)object
%field_image
/phlo/resources/fields/image.phlo
prop
%field_image -> delete
line 11
Prompts the user with a confirmation message asking if they want to delete the image.
'Delete image?'prop
%field_image -> uri
line 12
This expression retrieves the URI of an image field by appending the base path '/images/' to the field's value.
'/images/'prop
%field_image -> path
line 13
The `field_image->$path` accesses the path of the image stored in the `field_image` resource.
imagesprop
%field_image -> thumbPath
line 14
The `thumbPath` field in the `field_image` object retrieves the path to the thumbnail image stored in the `thumbs` resource.
thumbsprop
%field_image -> thumbSize
line 15
The `field_image->$thumbSize` property defines the size of the thumbnail image for a given field in Phlo.
64prop
%field_image -> thumbUri
line 16
This prop generates a thumbnail URI by appending '/thumbs/' to the field_image value.
'/thumbs/'method
%field_image -> label ($record)
line 18
Generates an HTML anchor tag containing an image, linking to a specified URI based on the provided record data. If the record does not contain a filename, it returns a dash instead.
($filename = $record->{$this->name}) ? tag('a', href: $this->uri.($url = $record->{$this->name.'_token'}.slash.rawurlencode($filename)), target: 'image', inner: tag('img', src: $this->thumbUri.$url)) : dashmethod
%field_image -> input ($record)
line 19
Generates an HTML input element for uploading an image, along with a preview of the current image if available, and an optional checkbox for deleting the image.
$input = void
$file = $record->{$this->name} ? $this->read($record, $this->thumbPath) : null
$input .= lf.tab.tag('img', src: $file ? $this->thumbUri.$record->{$this->name.'_token'}.slash.rawurlencode($record->{$this->name}) : '/image.select.jpg', class: 'image')
$input .= lf.tab.input(type: 'file', class: 'image-input', name: $this->name, accept: 'image/*', data_size: $this->thumbSize)
$file && $this->canDelete && $input .= lf.tab.tag('div', inner: tag('label', inner: input(type: 'checkbox', name: $this->name.'Delete')." $this->delete"))
return $input.lfmethod
%field_image -> write ($file)
line 28
Writes an image file to a specified path and moves the original file to another location, while also scaling the image to a defined thumbnail size.
%img($file->file)->scale($this->thumbSize, $this->thumbSize)->save($this->writePath($file, $this->thumbPath)) && $file->move($this->writePath($file))prop
%field_image -> objColumns
line 30
This expression retrieves the columns associated with the field_image, specifically the column names defined by the object's name and its token variant.
[$this->name, $this->name.'_token']view
script
line 32
This script handles click events on image elements to trigger a file input and processes image changes to resize the uploaded image before updating the source of the previous sibling element.
on('click', '.input.image .image', (img) => img.nextElementSibling.click())
on('change', '.input.image .image-input', (input) => imageResizer(input.files[0], input.dataset.size, input.dataset.size, (image) => input.previousElementSibling.src = image))object
%field_many
/phlo/resources/fields/many.phlo
prop
%field_many -> list
line 11
The field_many->$list property is used to define a list of labels for a field in a Phlo application.
'label'prop
%field_many -> record
line 12
Accesses the 'label' field of each record in a collection of records.
'label'prop
%field_many -> create
line 13
Creates multiple instances of a field in a resource.
falseprop
%field_many -> change
line 14
The field_many->$change property indicates whether changes have occurred in the field's value.
falsemethod
%field_many -> count ($record)
line 16
Returns the count of records associated with the specified field name in the given record.
$record->getCount($this->name)method
%field_many -> label ($record)
line 17
Generates a label for each item in a many-to-many relationship from the given record, linking to the related entities.
loop($record->{$this->name}, fn($relation) => $this->link($relation), lf) ?: dashmethod
%field_many -> link ($record)
line 18
Generates an anchor (`<a>`) element linking to a specific record's URI, using the record's ID and class for the URL, and applies the 'async' class for asynchronous loading.
tag('a', href: slash.($record::$uriRecord ?? $record::class).slash.$record->id, class: 'async', inner: $record)method
%field_many -> input ($record)
line 19
Generates an input field for each item in the specified record, using the label method to set the field's label.
$this->label($record)prop
%field_many -> objColumns
line 21
The field_many->$objColumns property holds an array of column objects associated with a many-to-many relationship in a Phlo resource.
[]object
%field_multiselect
/phlo/resources/fields/multiselect.phlo
method
%field_multiselect -> label ($record)
line 11
Returns the label for a multiselect field based on the provided record, defaulting to a dash if the value is empty.
($v = (string)($record->{$this->name} ?? '')) !== '' ? $v : dashmethod
%field_multiselect -> input ($record)
line 13
$current = array_filter(array_map('trim', explode(',', (string)($record->{$this->name} ?? ''))))
$js = "var f=this.closest('.field');f.querySelector('input.msv').value=[...f.querySelectorAll('input.msc:checked')].map(c=>c.value).join(',')"
$boxes = loop((array)$this->options, fn($o) => tag('label', tag('input', type: 'checkbox', value: (string)$o, class: 'msc', checked: in_array((string)$o, $current) ? true : void, onchange: $js).esc((string)$o), class: 'ms-opt'), void)
return tag('input', type: 'hidden', name: $this->name, value: implode(',', $current), class: 'msv').tag('div', $boxes ?: tag('span', 'geen opties', class: 'muted'), class: 'ms-grid')prop
%field_multiselect -> objColumns
line 20
This retrieves the value of the field identified by the name property from the current object context.
[$this->name]object
%field_number
/phlo/resources/fields/number.phlo
prop
%field_number -> decimals
line 11
The `field_number->$decimals` property specifies the number of decimal places for a numeric field in Phlo.
prop
%field_number -> length
line 12
This defines the length property of a field_number, specifying the maximum number of digits allowed.
5prop
%field_number -> min
line 13
This prop defines the minimum value for a number field in a view.
method
%field_number -> label ($record)
line 15
Formats a numeric field from the given record according to specified decimal places, using a comma as the thousands separator and a dot as the decimal point.
number_format($record->{$this->name}, $this->decimals, comma, dot)method
%field_number -> input ($record)
line 16
Generates an HTML input element of type 'number' with specified attributes, including name, value, step, and min, using data from the provided record.
input(type: 'number', name: $this->name, value: $record->{$this->name} ?? $this->default, step: $this->decimals ? dot.str_repeat('0', $this->decimals - 1).'1' : null, min: $this->min, class: 'field')prop
%field_number -> objColumns
line 18
Accesses the column data associated with the field represented by the current object instance using its name.
[$this->name]object
%field_parent
/phlo/resources/fields/parent.phlo
method
%field_parent -> label ($record)
line 11
Returns the label of the parent field for a given record, linking to the model if applicable, otherwise returning a dash.
is_a($obj = $record->{$this->name}, 'model') ? $this->link($obj) : dashmethod
%field_parent -> input ($record)
line 12
Generates an HTML <select> input element populated with options based on the provided $record, marking the option as selected if it matches the record's ID.
select(name: $this->name, inner: loop($this->options, fn($parent) => '<option'.($parent->id === $record->{$this->name}?->id ? ' selected' : void).' value="'.$parent->id.'">'.$parent, void))method
%field_parent -> link ($record, $content = null)
line 13
Generates an anchor (`<a>`) HTML element linking to a specific record's URI, using the record's ID and an optional inner content.
tag('a', href: slash.($record::$uriRecord ?? $record::class).slash.$record->id, class: 'async', inner: $content ?? $record)prop
%field_parent -> options
line 14
Accesses the options associated with the parent field in the context of the current object records.
$this->obj::records()prop
%field_parent -> objColumns
line 16
Accesses the columns of the parent object in the context of the current field.
[$this->name]object
%field_password
/phlo/resources/fields/password.phlo
prop
%field_password -> list
line 11
The field_password->$list expression is used to access a list of password fields in a Phlo application, returning false if no such fields exist.
falseprop
%field_password -> required
line 12
Specifies whether the password field is required for form submission, with a value of true indicating that it is mandatory.
trueprop
%field_password -> minlength
line 13
Sets the minimum length requirement for the password field.
8prop
%field_password -> placeholder
line 14
Sets the placeholder text for the password input field to 'New password'.
'New password'method
%field_password -> input ($record)
line 16
Generates an input field for a password with specified attributes such as type, name, placeholder, and class.
input(type: $this->type, name: $this->name, placeholder: $this->placeholder, class: 'field')method
%field_password -> label ($record)
line 17
Generates a label for a password field based on the provided record.
'••••••••'method
%field_password -> parse ($record)
line 18
Parses the password field from the payload, trims it, and hashes it using PASSWORD_BCRYPT before storing it in the record.
($password = trim(%payload->{$this->name})) && $record->{$this->name} = password_hash($password, PASSWORD_BCRYPT)prop
%field_password -> objColumns
line 20
Accesses the password field from the objColumns array using the current object's name as the key.
[$this->name]object
%field_price
/phlo/resources/fields/price.phlo
prop
%field_price -> decimals
line 11
This property defines the number of decimal places for the price field.
2object
%field_select
/phlo/resources/fields/select.phlo
method
%field_select -> input ($record)
line 11
Generates a select input field with options based on the provided $record, marking the current option as selected if it matches the value in $record.
select(name: $this->name, inner: loop($this->options, fn($option) => "<option".($record->{$this->name} === $option ? ' selected' : void).">$option", void))prop
%field_select -> objColumns
line 13
Accesses the column data associated with the current object's name in the context of a field selection.
[$this->name]object
%field_text
/phlo/resources/fields/text.phlo
prop
%field_text -> length
line 11
The field_text->$length property returns the length of the text in the field as an integer.
100prop
%field_text -> multiline
line 12
The field_text->$multiline property determines if the text field allows multiline input based on the condition that the length exceeds 250 characters.
$this->length > 250method
%field_text -> label ($record)
line 14
This function retrieves the label for a text field from a given record, truncating the value if it exceeds 100 characters and replacing line feeds with HTML breaks.
($value = $record->{$this->name}) === null ? dash : strtr(strlen($value) > 100 ? substr($value, 0, 80).'...' : $value, [lf => br])method
%field_text -> input ($record)
line 15
Generates an input field for text entry, using either a multi-line input or a single-line input based on the multiline property.
$this->multiline ? $this->inputMulti($record) : $this->inputField($record)method
%field_text -> inputField ($record)
line 16
Generates an input field for a form, using the specified type, name, value, maxlength, placeholder, and class attributes.
input(type: $this->type, name: $this->name, value: ($value = $record->{$this->name}) ? esc($value) : $this->default, maxlength: $this->length, placeholder: $this->placeholder, class: 'field')method
%field_text -> inputMulti ($record)
line 17
Generates a multi-line text input field using a textarea element, pre-filling it with a value from the provided record or a default value if none exists.
textarea(name: $this->name, inner: ($value = $record->{$this->name}) ? esc($value) : $this->default ?? void, placeholder: $this->placeholder, class: 'field')prop
%field_text -> objColumns
line 19
Accesses the column data associated with the field's name in the object.
[$this->name]object
%field_token
/phlo/resources/fields/token.phlo
prop
%field_token -> length
line 11
Returns the length of the field_token as an integer.
8prop
%field_token -> default
line 12
Generates a default token of a specified length using the token function.
token($this->length)prop
%field_token -> create
line 13
Creates a new field token in the context of a resource, returning false if the operation fails.
falseprop
%field_token -> change
line 14
The field_token->$change expression evaluates to false, indicating that there is no change in the field token.
falseprop
%field_token -> search
line 15
The field_token->$search expression evaluates to true, indicating that the search functionality is enabled for the field token.
truemethod
%field_token -> label ($record)
line 17
This function retrieves the label for a field token from a given record and wraps it in a 'div' tag, escaping any special characters.
tag('div', inner: esc($record->{$this->name}))method
%field_token -> parse ($record)
line 18
Parses a field token from the given record, assigning a default value if the token is not present.
$record->{$this->name} ??= $this->defaultprop
%field_token -> objColumns
line 20
Accesses the column data associated with the field token in the current object context.
[$this->name]object
%field_virtual
/phlo/resources/fields/virtual.phlo
prop
%field_virtual -> create
line 11
This property indicates whether the field is virtual and should be created dynamically.
falseprop
%field_virtual -> change
line 12
The field_virtual->$change property indicates whether the virtual field has changed from its previous value.
falseprop
%field_virtual -> objColumns
line 14
The field_virtual->$objColumns property is used to access the columns of a virtual field in an object.
[]object
%field_wysiwyg
/phlo/resources/fields/wysiwyg.phlo
method
%field_wysiwyg -> input ($record)
line 11
Generates a WYSIWYG editor input field, including a toolbar for text formatting and a hidden input to store the value.
$value = $record->{$this->name} ?? $this->default ?? void
$toolbar = tag('div', class: 'toolbar', inner: tag('button', type: 'button', data_command: 'bold', inner: '<b>B</b>').tag('button', type: 'button', data_command: 'italic', inner: '<i>I</i>').tag('button', type: 'button', data_command: 'underline', inner: '<u>U</u>').tag('button', type: 'button', data_command: 'insertUnorderedList', inner: '•').tag('button', type: 'button', data_command: 'insertOrderedList', inner: '1.'))
$editor = tag('div', class: 'editor', contenteditable: 'true', inner: $value)
$hiddenInput = textarea(name: $this->name, class: 'hidden-value', inner: $value)
return tag('div', class: 'wysiwyg-container', inner: "$toolbar$editor$hiddenInput")prop
%field_wysiwyg -> objColumns
line 19
Accesses the WYSIWYG field's columns as an object, allowing manipulation of the field's data structure.
[$this->name]view
script
line 21
This script enables a WYSIWYG editor by handling button clicks to execute commands and updating a hidden textarea with the editor's HTML content on input events.
on('click', '.wysiwyg-container .toolbar button', (button, e) => {
e.preventDefault()
const command = button.dataset.command
document.execCommand(command, false, null)
})
on('input', '.wysiwyg-container .editor', (editor) => {
const container = editor.closest('.wysiwyg-container')
const hiddenInput = container.querySelector('textarea.hidden-value')
hiddenInput.value = editor.innerHTML
})
on('click', '.wysiwyg-container .editor a', (a) => window.open(a.href))Functions
function
field($type, ...$args)
/phlo/resources/fields/field.phlo line 10
Creates a field with a specified type and additional arguments, using the phlo function to generate a unique identifier for the field.
phlo("field_$type", ...$args, type: $type)