Association
This field allows to select and reorder multiple post type posts, taxonomy terms, users or comments. Useful for creating links between any of these items.
Setup methods
set_types($types)
It allows you to specify the types of data that you want to have available in this association field.
In this context:
typeis the data type –post,term,user,comment, or a custom value (if implemented).subtypeclarifies the exact type to be used.- For the 
post_typetype, you can usepost,pageor any other registered custom post type. - For the 
taxonomytype, you can usecategory,post_tagor any other registered custom taxonomy. - The 
subtypeis not used for theuserandcommenttypes. 
- For the 
 
Defaults to array(array('type' => 'post', 'post_type' => 'post'))
set_max($max)
Allows you to limit the maximum number of selected items in a association field. By default, there is no limit.
Field::make('association', 'crb_association')
    ->set_max(5)
allow_duplicates($allow)
If enabled will allow the same item to be selected more than once. By default, duplicates are not allowed.
Field::make('association', 'crb_association')
    ->allow_duplicates(true)
NB! To get all the association data (each entry containing id, type, subtype) array, you can set the association type in the retrieval functions. Example:
/* Get the association data as an array */
carbon_get_post_meta($id, $name, 'association'); 
/*
The above example returns: 
array( 
    0 => array(
        'id' => 20, 
        'type' => 'post', 
        'post_type' => 'page'
    ), 
    1 => array(
        'id' => 16, 
        'type' => 'term', 
        'taxonomy' => 'category'
    )
)
*/
/* Get the association data as plain array with IDs */
carbon_get_post_meta($id, $name); 
/* 
The above example returns: 
array( 
    0 => 20,
    1 => 16
)
Example
The example below registers the following options for the association field:
- Post Type: Page
 - Post Type: Post
 - Taxonomy: Category
 - Taxonomy: Post Tag
 - Users
 - Comments
 
Field::make('association', 'crb_association')
    ->set_types(array(
        array(
            'type' => 'post',
            'post_type' => 'page',
        ),
        array(
            'type' => 'post',
            'post_type' => 'post',
        ),
        array(
            'type' => 'term',
            'taxonomy' => 'category',
        ),
        array(
            'type' => 'term',
            'taxonomy' => 'post_tag',
        ),
        array(
            'type' => 'user',
        ),
        array(
            'type' => 'comment',
        ),
    ))
					
									