TemplateFieldHandler::prepareTags

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. TemplateFieldHandler
  4. prepareTags
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/handler/templatefieldhandler.php
  • Класс: BitrixTasksControlHandlerTemplateFieldHandler
  • Вызов: TemplateFieldHandler::prepareTags
public function prepareTags(): self
{
	if (
		!array_key_exists('TAGS', $this->fields)
		&& !array_key_exists('SE_TAG', $this->fields)
	)
	{
		return $this;
	}

	$tags = [];

	if (
		isset($this->fields['TAGS'])
		&& is_array($this->fields['TAGS'])
	)
	{
		$tags = $this->fields['TAGS'];
	}

	if (
		isset($this->fields['SE_TAG'])
		&& is_array($this->fields['SE_TAG'])
	)
	{
		foreach ($this->fields['SE_TAG'] as $tag)
		{
			if (empty($tag))
			{
				continue;
			}

			if (is_string($tag))
			{
				$tags[] = $tag;
			}
			else if (is_array($tag))
			{
				$tags[] = $tag['NAME'];
			}
		}
	}

	$this->fields['TAGS'] = array_unique($tags);

	return $this;
}

Добавить комментарий