Find fields based on group ID, post ID, etc.
<?php CFS()->find_fields( $params ); ?>
$params
defaults:
<?php
$params = array(
'post_id' => false, // (int) single post ID
'group_id' => array(), // (int) group ID, or (array) group IDs
'field_id' => array(), // (int) field ID, or (array) field IDs
'field_type' => array(), // (string) field type, or (array) field types
'field_name' => array(), // (string) field name, or (array) field names
'parent_id' => array() // (int) group ID, or (array) group IDs
);
Examples
Find all fields within a specific field group
<?php
$fields = CFS()->find_fields( array( 'group_id' => 123 ) );
Find all fields with a specific field type
<?php
$fields = CFS()->find_fields( array( 'field_type' => 'relationship' ) );
Find all text or textarea fields within a specific field group
<?php
$fields = CFS()->find_fields( array(
'field_type' => array( 'text', 'textarea' ),
'group_id' => 123,
) );