ACF_To_REST_API_Term_Controller::get_rest_base PHP Method

get_rest_base() protected method

protected get_rest_base ( $request )
        protected function get_rest_base($request)
        {
            global $wp_taxonomies;
            $taxonomy = false;
            if ($request instanceof WP_REST_Request) {
                $taxonomy = $request->get_param('taxonomy');
            }
            if ($taxonomy && !array_key_exists($taxonomy, $wp_taxonomies)) {
                foreach ($wp_taxonomies as $tax_key => $tax_value) {
                    if (isset($tax_value->rest_base) && $taxonomy == $tax_value->rest_base) {
                        $request->set_param('taxonomy', $tax_key);
                        return $tax_key;
                    }
                }
            }
            return $taxonomy;
        }