64 $manifest = $block->getManifest();
65 $globalSkipContent =
false;
66 if ($manifest[
'nodes'][$selector][
'skipContent'] ??
false)
68 $globalSkipContent =
true;
71 $doc = $block->getDom();
72 $resultList = $doc->querySelectorAll($selector);
73 $valueBefore = static::getNode($block, $selector);
76 foreach ($data as $pos => $value)
78 $text = (isset($value[
'text']) && is_string($value[
'text'])) ? trim($value[
'text']) :
'';
79 $href = (isset($value[
'href']) && is_string($value[
'href'])) ? trim($value[
'href']) :
'';
80 $query = (isset($value[
'query']) && is_string($value[
'query'])) ? trim($value[
'query']) :
'';
81 $target = (isset($value[
'target']) && is_string($value[
'target'])) ? trim(mb_strtolower($value[
'target'])) :
'';
82 $attrs = isset($value[
'attrs']) ? (array)$value[
'attrs'] : array();
83 $skipContent = $globalSkipContent || (isset($value[
'skipContent']) ? (boolean)$value[
'skipContent'] :
false);
84 $result[$pos][
'attrs'] = [];
88 $href .= (mb_strpos($href,
'?') ===
false && !$isIframe) ?
'?' :
'&';
92 if (isset($value[
'text']) && !$text)
97 if (isset($resultList[$pos]))
102 trim($resultList[$pos]->getTextContent()) !=
''
105 $text = \htmlspecialcharsbx($text);
106 $result[$pos][
'content'] = $text;
107 $resultList[$pos]->setInnerHTML($text);
112 $result[$pos][
'attrs'][
'href'] = $href;
113 $resultList[$pos]->setAttribute(
'href', $href);
116 if (self::isAllowedTarget($target))
118 $result[$pos][
'attrs'][
'target'] = $target;
119 $resultList[$pos]->setAttribute(
'target', $target);
125 foreach ($attrs as $code => $val)
127 if ($val && in_array($code, $allowedAttrs))
129 $result[$pos][
'attrs'][$code] = $val;
130 $resultList[$pos]->setAttribute($code, $val);
136 foreach ($allowedAttrs as $attr)
138 $resultList[$pos]->removeAttribute($attr);
145 $history->push(
'EDIT_LINK', [
147 'selector' => $selector,
148 'position' => (
int)$pos,
149 'valueBefore' => $valueBefore[$pos],
150 'valueAfter' => $value,
251 if (empty($field[
'actions']) || !is_array($field[
'actions']))
257 foreach ($field[
'actions'] as $row)
259 if (empty($row) || !is_array($row))
263 $row = array_change_key_case($row, CASE_LOWER);
265 $row[
'name'] = static::prepareStringValue($row,
'name');
266 $row[
'type'] = static::prepareStringValue($row,
'type');
267 if (empty($row[
'name']) || empty($row[
'type']))
271 if (isset($dublicate[$row[
'type']]))
277 'type' => $row[
'type'],
278 'name' => $row[
'name']
280 $dublicate[$row[
'type']] =
true;
283 return (!empty($result) ? $result :
null);