lithium\console\command\g11n\Extract::_configuration()

protected method

Helps in selecting or - if required - adding a new Catalog collection used for extracting or writing the template. A special configuration with the name temporary may be created. Should a configuration with that same name exist prior to entering this method it will be unset.

Parameters

  • array $options

    Options paired with defaults to prompt for.

Returns

string

The name of the selected or newly created configuration.

Source

	protected function _configuration(array $options = array()) {
		$configs = (array) Catalog::config();

		if (isset($configs['temporary'])) {
			unset($configs['temporary']);
		}

		if ($configs) {
			$this->out('Available `Catalog` Configurations:');
			$prompt = 'Please choose a configuration or hit enter to add a new one:';

			foreach ($configs as $name => $config) {
				$this->out(" - {$name}");
			}
		} else {
			$this->out(' - No configuration found. -');
			$prompt = 'Please hit enter to add a temporary configuration:';
		}
		$this->out();

		$name = $this->in($prompt, array(
			'choices' => array_keys($configs),
			'default' => 'temporary'
		));

		if ($name == 'temporary') {
			foreach ($options as $option => $default) {
				$configs[$name][$option] = $this->in(ucfirst($option) . ':', compact('default'));
			}
			Catalog::config($configs);
		}
		return $name;
	}