• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task/template.php
  • Класс: Bitrix\Tasks\Dispatcher\PublicAction\Task\Template
  • Вызов: Template::find
public function find(array $parameters = array())
{
	if(!array_key_exists('limit', $parameters) || intval($parameters['limit'] > 10))
	{
		$parameters['limit'] = 10;
	}
	$selectIsEmpty = !array_key_exists('select', $parameters) || !count($parameters['select']);

	$data = array();
	$result = Item\Task\Template::find($parameters);

	if($result->isSuccess())
	{
		/** @var Item $item */
		foreach($result as $item)
		{
			// todo: in case of REST, ALL dates should be converted to the ISO string (write special exporter here, instead of Canonical)
			$data[] = $item->export($selectIsEmpty ? array() : '~'); // export ALL or only selected
		}
	}
	else
	{
		// clear DATA because we do not want error detail info sent to the client
		$this->errors->load($result->getErrors()->transform(array('DATA' => null)));
	}

	return array(
		'DATA' => $data,
	);
}