protected function fixActionParameters($action, $parameters) { $parameters = parent::fixActionParameters($action, $parameters); if ('_export' == $action && !isset($parameters['action'])) { $parameters['action'] = 'export'; } return $parameters; }
/** * Returns the configuration value for a given key. * * If the key is null, the method returns all the configuration array. * * @param string $key A key string * @param mixed $default The default value if the key does not exist * @param Boolean $escaped Whether to escape single quote (false by default) * * @return mixed The configuration value associated with the key */ public function getConfig($key = null, $default = null, $escaped = false) { if (null === $key) { return $this->config; } $value = sfModelGeneratorConfiguration::getFieldConfigValue($this->config, $key, $default); return $escaped ? str_replace("'", "\\'", $value) : $value; }
/** * Returns the configuration value for a given key. * * If the key is null, the method returns all the configuration array. * * @param string $key A key string * @param mixed $default The default value if the key does not exist * @param Boolean $escaped Whether to escape single quote (false by default) * * @return mixed The configuration value associated with the key */ public function getConfig($key = null, $default = null, $escaped = false) { if (is_null($key)) { return $this->config; } if ('label' == $key && !isset($this->config['label'])) { return sfInflector::humanize(sfInflector::underscore($this->name)); } $value = sfModelGeneratorConfiguration::getFieldConfigValue($this->config, $key, $default); return $escaped ? str_replace("'", "\\'", $value) : $value; }
/** * Gets the configuration for a given field. * * @param string $key The configuration key (title.list.name for example) * @param mixed $default The default value if none has been defined * @param Boolean $escaped Whether to escape single quote (false by default) * * @return mixed The configuration value */ public function getValue($key, $default = null, $escaped = false) { if (preg_match('/^(?P<context>[^\\.]+)\\.(?P<key>.+)$/', $key, $matches)) { $v = sfModelGeneratorConfiguration::getFieldConfigValue($this->getContextConfiguration($matches['context']), $matches['key'], $default); } elseif (!isset($this->configuration[$key])) { throw new InvalidArgumentException(sprintf('The key "%s" does not exist.', $key)); } else { $v = $this->configuration[$key]; } return $escaped ? str_replace("'", "\\'", $v) : $v; }
/** * Gets the configuration for a given field. * * @param string $key The configuration key (title.list.name for example) * @param mixed $default The default value if none has been defined * @param Boolean $escaped Whether to escape single quote (false by default) * * @return mixed The configuration value */ public function getValue($key, $default = null, $escaped = false) { if (preg_match('/^(?P<context>[^\\.]+)\\.fields\\.(?P<field>[^\\.]+)\\.(?P<key>.+)$/', $key, $matches)) { $v = $this->getFieldConfiguration($matches['context'], $matches['field'])->getConfig($matches['key'], $default); } else { if (preg_match('/^(?P<context>[^\\.]+)\\.(?P<key>.+)$/', $key, $matches)) { $v = sfModelGeneratorConfiguration::getFieldConfigValue($this->getContextConfiguration($matches['context']), $matches['key'], $default); } else { throw new InvalidArgumentException(sprintf('Configuration key "%s" is invalid.', $key)); } } return $escaped ? str_replace("'", "\\'", $v) : $v; }