Carbon_Fields\Helper\Helper::get_field_value_by_store PHP Method

get_field_value_by_store() public static method

Handles the logic for different data stores (containers).
public static get_field_value_by_store ( string $store_type, string $name, integer $id = null ) : mixed
$store_type string Data store type.
$name string Custom field name.
$id integer ID (optional).
return mixed Meta value.
    public static function get_field_value_by_store($store_type, $name, $id = null)
    {
        $args = array($id, $name, true);
        $function = '';
        switch ($store_type) {
            case 'post_meta':
                $function = 'get_post_meta';
                break;
            case 'user_meta':
                $function = 'get_user_meta';
                break;
            case 'comment_meta':
                $function = 'get_comment_meta';
                break;
            case 'term_meta':
                $function = 'get_metadata';
                $args = array('term', $id, $name, true);
                break;
            case 'theme_options':
                $function = 'get_option';
                $args = array($name);
                break;
        }
        if (!empty($function) && function_exists($function)) {
            return call_user_func_array($function, $args);
        }
        return false;
    }