E
E
Eugene M.2019-12-15 18:19:43
1C-Bitrix
Eugene M., 2019-12-15 18:19:43

How is INPUT formed in Bitrix?

How is <?= $arItem["INPUT"] ?> formed in /bitrix/catalog.filter? Now it is already displayed ready, but do I need to add a placeholder and my class to it? Where can I find its template?

<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);
?>

<form name="<? echo $arResult["FILTER_NAME"] . "_form" ?>" action="<? echo $arResult["FORM_ACTION"] ?>" method="get"
      class="section_position__form_sp sp_div_block">
    <h2 class="section_position__form_sp__h2">Фильтр для поиска врачей</h2>

    <? foreach ($arResult["ITEMS"] as $arItem): ?>
        <? if (array_key_exists("HIDDEN", $arItem)): ?>
            <?= $arItem["INPUT"] ?>
        <? else: ?>
            <div class="sp_div_block_1">
                <label class="section_position__form_sp__label"><?= $arItem["NAME"] ?></label>
                <?= $arItem["INPUT"] ?>
            </div>
        <? endif ?>
    <? endforeach; ?>

    <div class="sp_div_block_6">
        <input type="submit" name="set_filter" value="Найти" class="section_position__form_sp__submit"/>
        <input type="hidden" name="set_filter" value="Y"/>
        <input type="submit" name="del_filter" value="Сбросить фильтр" class="section_position__form_sp__button"/>
    </div>

</form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
ragnar_ok, 2019-12-16
@ragnar_ok

Not "the core of the kernel", of course, but if you want to use $arItem["INPUT"]the component, then you will have to customize the component. Inputs are formed in component.php:

bitrix:catalog.filter: /bitrix/components/bitrix/catalog.filter/component.php:411
( Hello MVC! ).
You can do without customizing the . To do this, simply examine $arResultthe component. There you will find everything you need to form an input (for example, a LIST array for the value attribute ). Get rid of $arItem["INPUT"]in your template and shape your input . In your case it will look something like this:
<?foreach ($arItem["LIST"] as $key => $value):?>
    <div class="sp_div_block_1">
        <label class="section_position__form_sp__label"><?= $arItem["NAME"] ?></label>
        <input type="radio" name="<?=$arItem["INPUT_NAME"]?>" value="<?=htmlspecialcharsBx($key)?>"/>
    </div>
<?endforeach;?>

M
Mikhail Prokhorov, 2019-12-16
@pro6ka

The input is formed by a function hidden in the bowels of the kernel. To change its behavior, at least the component will have to be redefined. It is better to transfer the output to preg_replase and replace / append with regular expressions what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question