- ⌂ cObject
- Methods
- Constructor
- add_variant()
- approve()
- as_array()
- can_add_variant()
- can_delete_variant()
- can_edit_variant()
- can_reorder_variant()
- clone()
- delete()
- edit_variant()
- enum()
- get_active_object()
- get_all_variants()
- get_attributes()
- get_dimensions()
- get_dimension_with()
- get_parent()
- get_primary_cpath()
- get_variant()
- Keywords()
- lock_object()
- reload_data()
- repo()
- revert()
- save()
- store()
- unlock_object()
- update_from_array()
- validate()
cObject::enum()
Gets the Title of the selected choice of a given field, for a field with Choices.
Returns the Title of the selected choice as a string. If no choice is selected, NULL is returned. If an "Other" choice is filled in, the value is returned as a string.
Field choices are defined from the Appearance tab in the Edit Field sidebar of the Content Type Editor View.
Prototype
string enum(mixed $field)
Parameters
- field - Field to get the selected Title for. It may be provided as an Identifier or Content Type Field. If not specified, objects that reference this object via any forward reference field will be included in the collection.
Return
Returns the Title of the selected choice as a string. If no choice is selected, NULL is returned. If an "Other" choice is filled in, the value is returned as a string.
Example
$repo = \comand::repo();
$contact = $repo->get_first('FROM Contact');
// get all contacts this contact is an Emergency Contact for
$contact_type = $contact->enum('ContactType');
echo("$contact is a $contact_type contact.\n");