ElggPlugin::getAllSettings PHP Method

getAllSettings() public method

Returns an array of all settings saved for this plugin.
public getAllSettings ( ) : array
return array An array of key/value pairs.
    public function getAllSettings()
    {
        $defaults = $this->getStaticConfig('settings', []);
        $values = _elgg_services()->pluginSettingsCache->getAll($this->guid);
        if ($values !== null) {
            return array_merge($defaults, $values);
        }
        if (!$this->guid) {
            return false;
        }
        $db_prefix = _elgg_services()->config->get('dbprefix');
        // need to remove all namespaced private settings.
        $us_prefix = _elgg_namespace_plugin_private_setting('user_setting', '', $this->getID());
        $is_prefix = _elgg_namespace_plugin_private_setting('internal', '', $this->getID());
        // Get private settings for user
        $q = "SELECT * FROM {$db_prefix}private_settings\n\t\t\tWHERE entity_guid = {$this->guid}\n\t\t\tAND name NOT LIKE '{$us_prefix}%'\n\t\t\tAND name NOT LIKE '{$is_prefix}%'";
        $private_settings = $this->getDatabase()->getData($q);
        $return = [];
        if ($private_settings) {
            foreach ($private_settings as $setting) {
                $return[$setting->name] = $setting->value;
            }
        }
        return array_merge($defaults, $return);
    }