1

I am creating an extension where on install I am creating a Channel and adding Fields to the Channel using the EE API. I have found all the API functions to do this but the one thing I have not found in the API is how to create the Channel Field Group that the Fields get added to.

Anyone know where to find documentation on how to create the Channel Field Group?

1 Answer 1

1

So there is no way to do this with the EE API. You need to use the Database class and use the insert function like so.

    ee()->db->insert(
        'field_groups',
        array(
            'site_id'  => 1,
            'group_name'  => 'Group Name'
        )
    );

    $group_id = ee()->db->insert_id();

    return $group_id;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.