Cake\Controller\Component\PaginatorComponent::mergeOptions PHP Method

mergeOptions() public method

Pulls settings together from the following places: - General pagination settings - Model specific settings. - Request parameters The result of this method is the aggregate of all the option sets combined together. You can change config value whitelist to modify which options/values can be set using request parameters.
public mergeOptions ( string $alias, array $settings ) : array
$alias string Model alias being paginated, if the general settings has a key with this value that key's settings will be used for pagination instead of the general ones.
$settings array The settings to merge with the request data.
return array Array of merged options.
    public function mergeOptions($alias, $settings)
    {
        $defaults = $this->getDefaults($alias, $settings);
        $request = $this->_registry->getController()->request;
        $scope = Hash::get($settings, 'scope', null);
        $query = $request->query;
        if ($scope) {
            $query = Hash::get($request->query, $scope, []);
        }
        $request = array_intersect_key($query, array_flip($this->_config['whitelist']));
        return array_merge($defaults, $request);
    }