Config

class Config

Extends FuelPHP config class and provides new functionalities.

::mergeWithUser($key, $config)

static Config::mergeWithUser($key, $config)
Parameters:
  • $key (string) – Key in which the user’s configuration is saved.
  • $config (mixed) – Configuration to merge.
Returns:

The configuration merged.

Merge configuration with the one saved in user in the key $key.

::getDbName($key)

static Config::getDbName($key)
Parameters:
  • $key (string) – Key to be transformed.
Returns:

Valid user configuration key.

::configFile($class)

static Config::configFile($class)
Parameters:
  • $class (string) – Class we want to retrieve the configuration from.
Returns:

Returns a two element array: first element is the class’s application, and the second element is the relative path of the configuration file.

::metadata($application_name)

static Config::metadata($application_name)
Parameters:
  • $application_name (string) – Application we want to retrieve the metadata configuration from.
Returns:

The metadata configuration.

::application($application_name)

static Config::application($application_name)
Parameters:
  • $application_name (string) – Application we want to retrieve the global configuration from (located at application::config)
Returns:

The global configuration.

::actions($params)

static Config::actions($params = array())
Parameters:
  • $params (array) –

    Set of filters on actions.

    models:array Models on which we retrieve actions list.
    item:object (optional) Item which we want to associate the actions with (will allow to process the disabled key).
    all_targets:boolean Specify if we want to retrieve all actions (no matter target or visible value).
    target:string Which target we want to filter the actions on.
Returns:

The filtered actions.

::getActionDisabledState($disabled, $item)

static Config::getActionDisabledState($disabled, $item)
Parameters:
  • $disabled (mixed) – Disabled value to be processed.
  • $item (object) – Item necessary to process the disabled value.
Returns:

The processed disabled value.

::processCallbackValue($value, $positive_value, $argument_1, $argument_2, ...)

static Config::getActionDisabledState($value, $positive_value, $argument_1, $argument_2, ...)
Parameters:
  • $value (mixed) – Value to process.
  • $positive_value (object) – If the value is an array of callbacks, it defines which value is expected. If callback return the expected value, then we call next callback. Otherwise, we return the value.
  • $arguments (mixed) – All appended parameters are sent to the callback functions (if there is any).
Returns:

The first value which is different of $positive_value, otherwise $positive_value.

For instance:

<?php

// ----- With a simple value
getActionDisabledState(true, true); // returns true
getActionDisabledState(true, false); // returns true

// ----- With a callback
$value = function() {
    return true;
}

getActionDisabledState($value, true); // returns true
getActionDisabledState($value, false); // returns true

// ----- With a list of callbacks
$value = array(
    function() {
        return true;
    },
    function() {
        return false;
    }
);

getActionDisabledState($value, true); // returns false, since second callback is different from positive_value
getActionDisabledState($value, false); // returns true, since first callback is different from positive_value

// ----- With a list of mixed values
$value = array(
    true,
    function() {
        return false;
    }
);

// the first value is equivalent to a callback returning true, so there is no difference with previous example
getActionDisabledState($value, true); // returns false, since second value is different from positive_value
getActionDisabledState($value, false); // returns true, since first callback is different from positive_value

// ----- With additionnal parameters
$value = array(
    function($param1, $param2) {
        return $param1 == $param2;
    },
    function ($param1, $param2) {
        return $param1 != $param2;
    }
);

getActionDisabledState($value, true, 1, 1); // returns false, since second value is different from positive_value
getActionDisabledState($value, true, 1, 2); // returns false, since first value is different from positive_value
getActionDisabledState($value, false, 1, 1); // returns false, since first value is different from positive_value
getActionDisabledState($value, false, 1, 2); // returns false, since second value is different from positive_value

::placeholderReplace($to_be_replaced, $placeholders, $remove_unset)

static Config::placeholderReplace($to_be_replaced, $placeholders, $remove_unset = true)
Parameters:
  • $to_be_replaced (mixed) – Value to replace placeholders into. Can be a string or array.
  • $placeholders (array) – Associative array containing replacements.
  • $remove_unset (boolean) – If set to true, all placeholders which have not a associated replacements are replaced by an empty string. Otherwise, they are not replaced.
Returns:

The replaced value.

::icon($application_or_model_name, $icon_key)

static Config::icon($application_or_model_name, $icon_key)
Parameters:
  • $application_or_model_name (string) – Application or model name on which we want to retrieve the icon.
  • $icon_key (array) – Icon size.
Returns:

The icon url.

Read the Docs v: elche
Versions
latest
stable
elche
dubrovka
chiba.2
chiba.1
Downloads
pdf
htmlzip
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.