This commit is contained in:
2021-10-08 16:22:44 +03:00
parent d6ddca4532
commit cf1405bef6
8 changed files with 62 additions and 47 deletions
+4 -2
View File
@@ -1,5 +1,7 @@
<?php
use \Wt\Core\Templater\Tools as TemplaterTools;
/**
* @var array $arParams
*/
@@ -20,8 +22,8 @@ $preloader = \Wt\Core\Tools::isTrue($arParams['PRELOADER']);
<?if($arParams['ENTITY']){?>data-entity="<?=$arParams['ENTITY']?>"<?}?>
<?if($arParams['VALUE']){?>value="<?=$arParams['VALUE']?>"<?}?>
class="kit-button <?=$arParams['CLASS']?:app()->config()->get('templaterParams.button.class', '')?> <?=$arParams['ADD_CLASS']?><?=(!$preloader?' not-preloader ':'')?>"
onclick="<?=\Bx\Kit\Node\Lib::safeHtmlAttr($arParams['ONCLICK'])?>"
<?=\Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR']);?>
onclick="<?=TemplaterTools::safeHtmlAttr($arParams['ONCLICK'])?>"
<?=TemplaterTools::getAttrByArray($arParams['ATTR']);?>
><div class="kit-button__icon kit-icon"><?=$arParams['ICON']?></div>
<div class="kit-button__label kit-line-clamp"><?=$arParams['LABEL']?:$arParams['NAME']?:''?></div>
<div class="kit-button__border"></div>
+4 -1
View File
@@ -1,3 +1,6 @@
<div class="kit-field__hint kit-icon" data-bs-toggle="tooltip" title="<?=\Bx\Kit\Node\Lib::safeHtmlAttr($arParams['TITLE'])?>">
<?php
use Wt\Core\Templater\Tools as TemplaterTools;
?>
<div class="kit-field__hint kit-icon" data-bs-toggle="tooltip" title="<?=TemplaterTools::safeHtmlAttr($arParams['TITLE'])?>">
<?app()->service()->templater()->render('kit:svg/hint')?>
</div>
+6 -6
View File
@@ -3,8 +3,8 @@
* @var array $arParams
*/
use Wt\Core\Type\Str as Str;
use Wt\Core\Tools as Tools;
use Wt\Core\Templater\Tools as TemplaterTools;
use Wt\Core\Tools;
//include ".con/fields.php";
@@ -49,13 +49,13 @@ if($isHint) {
}
}
?>"
value="<?=Str::safeHtmlAttr($arParams['VALUE'])?>"
value="<?=TemplaterTools::safeHtmlAttr($arParams['VALUE'])?>"
maxlength="255"
placeholder="<?=Str::safeHtmlAttr($arParams['PLACEHOLDER']).''?>"
placeholder="<?=TemplaterTools::safeHtmlAttr($arParams['PLACEHOLDER']).''?>"
<?
echo \Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR']);
echo TemplaterTools::getAttrByArray($arParams['ATTR']);
if($isDatepicker) {
echo \Bx\Kit\Node\Lib::getAttrByArray([
echo TemplaterTools::getAttrByArray([
'data-position' => 'bottom left'
]);
}
+2 -1
View File
@@ -1,8 +1,9 @@
<?php
use \Wt\Core\Templater\Tools as TemplaterTools;
?>
<div class="modal fade <?=$arParams['WRAP_CLASS']?>" id="<?=$arParams['ID']?>" tabindex="-1" aria-labelledby="<?=$arParams['ID']?>" aria-hidden="true" <?=\Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR'])?>>
<div class="modal fade <?=$arParams['WRAP_CLASS']?>" id="<?=$arParams['ID']?>" tabindex="-1" aria-labelledby="<?=$arParams['ID']?>" aria-hidden="true" <?=TemplaterTools::getAttrByArray($arParams['ATTR'])?>>
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
+3 -4
View File
@@ -1,10 +1,9 @@
<?php
use Bx\Kit\Lib\Type\Str as StrAlias;
use Wt\Core\Templater\Tools as TemplaterTools;
$root = '';
if(strlen($arParams['ROOT'])) {
$root = StrAlias::safeHtmlAttr($arParams['ROOT']) . ':';
$root = TemplaterTools::safeHtmlAttr($arParams['ROOT']) . ':';
}
?><meta property="<?=$root?><?= StrAlias::safeHtmlAttr($arParams['PROPERTY']?:$arParams['NAME'])?>" content="<?= StrAlias::safeHtmlAttr($arParams['CONTENT']?:$arParams['VALUE'])?>">
?><meta property="<?=$root?><?=TemplaterTools::safeHtmlAttr($arParams['PROPERTY']?:$arParams['NAME'])?>" content="<?= TemplaterTools::safeHtmlAttr($arParams['CONTENT']?:$arParams['VALUE'])?>">
+12 -8
View File
@@ -1,15 +1,19 @@
<?
use Wt\Core\Type;
use \Wt\Core\Templater\Tools as TemplaterTools;
?>
<picture class="kit-picture <?=$arParams['CLASS']?>">
<?
$webp = new \Bx\Kit\Image\Webp($_SERVER['DOCUMENT_ROOT'] . $arParams['SRC']);
if($webp->convert()->isSuccess()) {
$webpSrc = $webp->getRelativePath();
?><source srcset="<?=$webpSrc?>" type="image/webp"><?
$webp = new \Wt\Core\Media\Webp($_SERVER['DOCUMENT_ROOT'] . $arParams['SRC']);
if($webp->make()->isSuccess()) {
?><source srcset="<?=$webp->getPathOut(true)?>" type="image/webp"><?
}
?>
<img class="kit-img" src="<?=$arParams['SRC']?>" alt="<?=Type\Str::safeHtmlAttr($arParams['ALT'])?>"<?if($arParams['TITLE']) {?> title="<?=Type\Str::safeHtmlAttr($arParams['TITLE'])?>"<?}?>
<?=\Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR']);?>
/>
<img class="kit-img" src="<?=$arParams['SRC']?>" alt="<?=TemplaterTools::safeHtmlAttr($arParams['ALT'])?>"<?
if($arParams['TITLE']) {
?> title="<?=TemplaterTools::safeHtmlAttr($arParams['TITLE'])?>"<?
}
echo TemplaterTools::getAttrByArray($arParams['ATTR']);
?>/>
</picture>
+14 -11
View File
@@ -1,16 +1,19 @@
<picture class="kit-picture">
<?
$webp = new \Bx\Kit\Image\Webp($_SERVER['DOCUMENT_ROOT'] . $arParams['SRC']);
if($webp->convert()->isSuccess()) {
$webpSrc = $webp->getRelativePath();
?><source class="owl-lazy" data-srcset="<?=$webpSrc?>" type="image/webp"><?
use \Wt\Core\Templater\Tools as TemplaterTools;
?>
<picture class="kit-picture <?=$arParams['CLASS']?>">
<?
$webp = new \Wt\Core\Media\Webp($_SERVER['DOCUMENT_ROOT'] . $arParams['SRC']);
if($webp->make()->isSuccess()) {
?><source class="owl-lazy" data-srcset="<?=$webp->getPathOut(true)?>" type="image/webp"><?
}
?>
<img class="kit-img owl-lazy" data-src="<?=$arParams['SRC']?>" alt="<?=\Bx\Kit\Lib\Type\Str::safeHtmlAttr($arParams['ALT'])?>"<?if($arParams['TITLE']) {?> title="<?=\Bx\Kit\Lib\Type\Str::safeHtmlAttr($arParams['TITLE'])?>"<?}?>
<?
if($arParams['ATTR']) {
echo \Bx\Kit\Template::get('attr', $arParams['ATTR']);
<img class="kit-img owl-lazy" data-src="<?=$arParams['SRC']?>" alt="<?=TemplaterTools::safeHtmlAttr($arParams['ALT'])?>"<?
if($arParams['TITLE']) {
?> title="<?=TemplaterTools::safeHtmlAttr($arParams['TITLE'])?>"<?
}
?>
/>
echo TemplaterTools::getAttrByArray($arParams['ATTR']);
?>/>
</picture>
+17 -14
View File
@@ -3,6 +3,9 @@
/**
* @var array $arParams
*/
use Wt\Core\Templater\Tools as TemplaterTools;
use Wt\Core\Tools;
use \Wt\Core\Type;
$arParamsDefault = [
@@ -36,7 +39,7 @@ $optionDefault = [
if(!isset($arParams['AUTO_SELECT'])) {
$arParams['AUTO_SELECT'] = $arParamsDefault['AUTO_SELECT'];
}
$arParams['AUTO_SELECT'] = \Bx\Kit\Tools::isTrue($arParams['AUTO_SELECT']);
$arParams['AUTO_SELECT'] = Tools::isTrue($arParams['AUTO_SELECT']);
if(!isset($arParams['OPTIONS_VALUE_KEY'])) {
$arParams['OPTIONS_VALUE_KEY'] = $arParamsDefault['OPTIONS_VALUE_KEY'];
@@ -47,22 +50,22 @@ if(!isset($arParams['OPTIONS_TEXT_KEY'])) {
$arParams['OPTIONS'] = (array)$arParams['OPTIONS'];
$arrowInLabel = \Bx\Kit\Tools::isTrue($arParams['ARROW_IN_LABEL']);
$arrowInLabel = Tools::isTrue($arParams['ARROW_IN_LABEL']);
if(!isset($arParams['CHECK_DIRTY'])) {
$arParams['CHECK_DIRTY'] = $arParamsDefault['CHECK_DIRTY'];
}
$checkDirty = \Bx\Kit\Tools::isTrue($arParams['CHECK_DIRTY']);
$checkDirty = Tools::isTrue($arParams['CHECK_DIRTY']);
$optionSelectedArray = [];
$hidden = \Bx\Kit\Tools::isTrue($arParams['HIDDEN']) || ($arParams['TYPE'] == 'hidden');
$multiple = \Bx\Kit\Tools::isTrue($arParams['MULTIPLE']);
$hidden = Tools::isTrue($arParams['HIDDEN']) || ($arParams['TYPE'] == 'hidden');
$multiple = Tools::isTrue($arParams['MULTIPLE']);
$optionsHtml = '';
if($arParams['OPTIONS']) {
if(strlen($arParams['SELECTED'])) {
foreach ($arParams['OPTIONS'] as $option) {
if(isset($option['VISIBLE']) && !\Bx\Kit\Tools::isTrue($option['VISIBLE'])) continue;
if(isset($option['VISIBLE']) && !Tools::isTrue($option['VISIBLE'])) continue;
if($arParams['SELECTED'] == Type\Arr::get($option, $arParams['OPTIONS_VALUE_KEY'])) {
$optionSelectedArray = $option;
break;
@@ -73,8 +76,8 @@ if($arParams['OPTIONS']) {
if($arParams['AUTO_SELECT']) {
if(!$optionSelectedArray) {
foreach ($arParams['OPTIONS'] as $option) {
if(isset($option['VISIBLE']) && !\Bx\Kit\Tools::isTrue($option['VISIBLE'])) continue;
if(\Bx\Kit\Tools::isTrue($option['SELECTED'])) {
if(isset($option['VISIBLE']) && !Tools::isTrue($option['VISIBLE'])) continue;
if(Tools::isTrue($option['SELECTED'])) {
$optionSelectedArray = $option;
break;
}
@@ -88,12 +91,12 @@ if($arParams['OPTIONS']) {
}
$optionsCount = 0;
foreach ($arParams['OPTIONS'] as $option) {
if(isset($option['VISIBLE']) && !\Bx\Kit\Tools::isTrue($option['VISIBLE'])) continue;
if(isset($option['VISIBLE']) && !Tools::isTrue($option['VISIBLE'])) continue;
$isSelected = (Type\Arr::get($optionSelectedArray, $arParams['OPTIONS_VALUE_KEY']) == Type\Arr::get($option, $arParams['OPTIONS_VALUE_KEY']));
$isDisabled = \Bx\Kit\Tools::isTrue($option['DISABLED']) || \Bx\Kit\Tools::isTrue($option['RESTRICTED']);
$isDisabled = Tools::isTrue($option['DISABLED']) || Tools::isTrue($option['RESTRICTED']);
$optionsCount++;
$optionsHtml .= ' <option value="'.Type\Arr::get($option, $arParams['OPTIONS_VALUE_KEY']).'" '. \Bx\Kit\Node\Lib::getAttrByArray($option['ATTR']) .
$optionsHtml .= ' <option value="'.Type\Arr::get($option, $arParams['OPTIONS_VALUE_KEY']).'" '. TemplaterTools::getAttrByArray($option['ATTR']) .
($isSelected?' selected':'').''.
($isDisabled?' disabled':'').'>'.Type\Arr::get($option, $arParams['OPTIONS_TEXT_KEY']).'</option>';
}
@@ -105,9 +108,9 @@ foreach ($arParams['OPTIONS'] as $option) {
name="<?=$arParams['NAME']?>"
<?if($arParams['ID']){?>id="<?=$arParams['ID']?>"<?}?>
<?if($multiple){?> multiple<?}?>
<?if($arParams['ONCHANGE']){?> onchange="<?=\Bx\Kit\Lib\Type\Str::safeHtmlAttr($arParams['ONCHANGE'])?>"<?}?>
<?if($arParams['ONCHANGE']){?> onchange="<?=TemplaterTools::safeHtmlAttr($arParams['ONCHANGE'])?>"<?}?>
class="kit-field__input <?=$arParams['CLASS']?> <?=$arParams['ADD_CLASS']?>"
<?=\Bx\Kit\Node\Lib::getAttrByArray($arParams['ATTR'])?>
<?=TemplaterTools::getAttrByArray($arParams['ATTR'])?>
<?if($arParams['PLACEHOLDER']){?>data-placeholder="<?=$arParams['PLACEHOLDER']?>"<?}?>
><?echo $optionsHtml?:$arParams['OPTIONS_HTML']; ?></select>
<?
@@ -116,7 +119,7 @@ foreach ($arParams['OPTIONS'] as $option) {
}?>
<?if(!$arrowInLabel){?><span class="kit-field__arrow"><?=app()->service()->templater()->get('kit:svg/chevronAnimate')?></span><?}?>
<span class="kit-field__display"><?=Type\Arr::get($optionSelectedArray, $arParams['OPTIONS_TEXT_KEY'])?:$arParams['PLACEHOLDER']?></span>
<span class="kit-field__label"><?=$arParams['LABEL']?:$arParams['NAME']?:''?><?if($arrowInLabel){?><span class="kit-field__arrow"><?=\Bx\Kit\Template::get('svg/chevronAnimate')?></span><?}?></span>
<span class="kit-field__label"><?=$arParams['LABEL']?:$arParams['NAME']?:''?><?if($arrowInLabel){?><span class="kit-field__arrow"><?=app()->service()->templater()->get('svg/chevronAnimate')?></span><?}?></span>
<span class="kit-field__error"></span>
<span class="kit-field__hr"></span>
<?if($arParams['AREA_LEFT']){?><div class="kit-field__area-left"><?=$arParams['AREA_LEFT']?></div><?}?>