lithium\template\helper\Form::_datalist()

protected method

Generates an HTML <datalist></datalist> object with <option> elements.

Parameters

  • array $list

    Valuues, which will be used to render the options of the datalist.

  • array $scope

    An array of options passed to the parent scope.

Returns

string

Returns a <datalist> tag with <option> elements.

Source

	protected function _datalist(array $list, array $scope) {
		$options = [];

		if (isset($scope['id'])) {
			$id = $options['id'] = $scope['id'] . 'List';
		}
		$raw = array_reduce($list, function($carry, $value) {
			return $carry .= $this->_render(__METHOD__, 'datalist-option', compact('value'));
		}, '');

		return [
			isset($options['id']) ? $options['id'] : null,
			$this->_render(__METHOD__, 'datalist', compact('options', 'raw'))
		];
	}