Support » Plugin: Custom Field Suite » [Plugin: Custom Field Suite] Get Field's Type and Choices (for select)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author logikal16

    (@logikal16)

    Yes and no.

    There’s a get_input_fields API method that retrieves all field information within a given field group. It’s not really intended to be directly accessed (it could change in time), but to use it:

    $choices = array();
    $group_id = YOUR_FIELD_GROUP_ID;
    $field_name = YOUR_SELECT_FIELD_NAME;
    
    $field_info = $cfs->api->get_input_fields($group_id);
    foreach ($field_info as $field) {
        if ('select' == $field->type && $field_name == $field->name) {
            $choices = $field->options['choices'];
        }
    }
    
    // Output the choices
    var_dump($choices);

    Cool thanks I’ll give it a try. BTW, LOVE the plug in… great job.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Suite] Get Field's Type and Choices (for select)’ is closed to new replies.