Field Name Patterns
A Field Name Pattern is a string which is used as a way to refer to a specific field when using the PHP or JavaScript APIs (mainly when getting or setting a field’s value).
Pattern schema
field_name[group_index]:group_type{/repeat}
Examples
In the following examples we’ll show you several field definitions and the corresponding patterns to refer to them.
Field::make( 'text', 'crb_text' )| Pattern | Refers to | 
|---|---|
| crb_text | The crb_text field | 
Field::make( 'complex', 'crb_services' )
    ->add_fields( array(
        Field::make( 'text', 'name' ),
    ) )| Pattern | Refers to | 
|---|---|
| crb_services | The crb_servicesfield | 
| crb_services[0]/name | The namefield for the firstcrb_servicesgroup | 
| crb_services[1]/name | The namefield for the secondcrb_servicesgroup | 
When you have custom groups defined you must specify the group name in the field pattern in order to resolve the correct fields (as different groups can have fields with identical names):
Field::make( 'complex', 'crb_services' )
    ->add_fields( 'digital', array(
        Field::make( 'text', 'name' ),
    ) )
    ->add_fields( 'physical', array(
        Field::make( 'textarea', 'name' ),
    ) )| Pattern | Refers to | 
|---|---|
| crb_services | The crb_servicesfield | 
| crb_services[0]:digital/name | The namefield for the firstcrb_servicesgroup | 
| crb_services[1]:digital/name | The namefield for the secondcrb_servicesgroup | 
Field::make( 'complex', 'crb_service_types' )
    ->add_fields( array(
        Field::make( 'text', 'name' ),
        Field::make( 'complex', 'services' )
            ->add_fields( array(
                Field::make( 'text', 'name' ),
            ) )
    ) )| Pattern | Refers to | 
|---|---|
| crb_service_types | The crb_service_typesfield | 
| crb_service_types[0]/name | The namefield for the firstcrb_service_typesgroup | 
| crb_service_types[0]/services | The servicesfield for the firstcrb_service_typesgroup | 
| crb_service_types[0]/services[0]/name | The first namefield for the firstservicesgroup for the firstcrb_services_typesgroup | 
