protected static function get_additional_search_area_categories() {
        $additionalcategories = [];

        // Allow plugins to add custom search area categories.
        if ($pluginsfunction = get_plugins_with_function('search_area_categories')) {
            foreach ($pluginsfunction as $plugintype => $plugins) {
                foreach ($plugins as $pluginfunction) {
                    $plugincategories = $pluginfunction();
                    // We're expecting a list of valid area categories.
                    if (is_array($plugincategories)) {
                        foreach ($plugincategories as $plugincategory) {
                            if (self::is_valid_area_category($plugincategory)) {
                                $additionalcategories[] = $plugincategory;
                            } else {
                                throw  new \coding_exception('Invalid search area category!');
                            }
                        }
                    } else {
                        throw  new \coding_exception($pluginfunction . ' should return a list of search area categories!');
                    }
                }
            }
        }

        return $additionalcategories;
    }