%PDF- %PDF-
| Direktori : /home/bitrix/www/bitrix/modules/landing/lib/node/ |
| Current File : /home/bitrix/www/bitrix/modules/landing/lib/node/map.php |
<?php
namespace Bitrix\Landing\Node;
class Map extends \Bitrix\Landing\Node
{
/**
* Get class - frontend handler.
* @return string
*/
public static function getHandlerJS()
{
return 'BX.Landing.Block.Node.Map';
}
/**
* Save data for this node.
* @param \Bitrix\Landing\Block &$block Block instance.
* @param string $selector Selector.
* @param array $data Data array.
* @return void
*/
public static function saveNode(\Bitrix\Landing\Block &$block, $selector, array $data)
{
$doc = $block->getDom();
$resultList = $doc->querySelectorAll($selector);
foreach ($data as $pos => $value)
{
if (isset($resultList[$pos]) && $value)
{
$resultList[$pos]->setAttribute(
'data-map',
$value
);
}
}
}
/**
* Get data for this node.
* @param \Bitrix\Landing\Block &$block Block instance.
* @param string $selector Selector.
* @return array
*/
public static function getNode(\Bitrix\Landing\Block &$block, $selector)
{
$data = array();
$doc = $block->getDom();
$resultList = $doc->querySelectorAll($selector);
foreach ($resultList as $pos => $res)
{
$data[$pos] = $res->getAttribute('data-map');
}
return $data;
}
}