Roots\Soil\Options::getByFile PHP Method

getByFile() public static method

public static getByFile ( $file )
    public static function getByFile($file)
    {
        if (file_exists($file) || file_exists(__DIR__ . '/modules/' . $file)) {
            return self::get('soil-' . basename($file, '.php'));
        }
        return [];
    }

Usage Example

Example #1
0
function options($option = null)
{
    static $options;
    if (!isset($options)) {
        $options = \Roots\Soil\Options::getByFile(__FILE__) + ['', 'wp_footer'];
        $options['gaID'] =& $options[0];
        $options['hook'] =& $options[1];
    }
    return is_null($option) ? $options : $options[$option];
}