• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/History/Action/EditStyleAction.php
  • Класс: BitrixLandingHistoryActionEditStyleAction
  • Вызов: EditStyleAction::enrichParams
static function enrichParams(array $params): array
{
	/**
	 * @var $block Block
	 */
	$block = $params['block'];

	$getValue = static function($content) {
		$doc = new DOMDocument();
		$doc->loadHTML($content);
		$children = $doc->getChildNodesArray();
		$node = array_pop($children);

		return $node
			? [
				'className' => $node->getClassName() ?: '',
				'style' => DOMStyleInliner::getStyle($node, true),
				'styleString' => $node->getAttribute('style') ?: '',
			]
			: [];
	};

	return [
		'block' => $block->getId(),
		'selector' => $params['selector'] ?: '',
		'isWrapper' => $params['isWrapper'] ?? false,
		'position' => $params['position'] ?? -1,
		'affect' => $params['affect'] ?: [],
		'lid' => $block->getLandingId(),
		'valueBefore' => $getValue($params['contentBefore']),
		'valueAfter' => $getValue($params['contentAfter']),
	];
}