eventespresso / eea-recurring-events-manager

EE4 Recurring Events Manager add-on for Event Espresso 4
GNU General Public License v3.0
0 stars 1 forks source link

Register REM GQL Resources with Core #16

Closed tn3rb closed 4 years ago

tn3rb commented 4 years ago

Since core uses Collections for managing all of the specific resource classes like Types and Loaders, REM can simply hook into those Collections from RecurringEventsManager::after_registration() to add its resources

example for registering GQL Types:

    /**
     * @since $VID:$
     */
    public function registerResources()
    {
        add_filter(
            'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs',
            [$this, 'registerTypes']
        );
        // other filters here for adding other resources
    }

    /**
     * @param array $collection_FQCNs
     * @return array
     * @since $VID:$
     */
    public function registerTypes(array $collection_FQCNs = [])
    {
        $collection_FQCNs[] = 'EventEspresso\RecurringEvents\src\domain\services\graphql\types\Recurrence';
        return $collection_FQCNs;
    }