L
L
lolka022019-02-18 18:57:50
1C-Bitrix
lolka02, 2019-02-18 18:57:50

How to display component parameters in component.php in Bitrix?

in the component I add a parameter
in the .parameters.php file in the component I write:

<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true) die();
$arComponentParameters = array(
    "PARAMETERS" => array(
        "SUCCESS_TEXT" => Array(
            "NAME" => "Текст",
            "DEFAULT" => "Спасибо",
        ),
    )
);

and in the component itself $arParams is empty. How to display this parameter in the component.php file?
the component is called like this
<?$APPLICATION->IncludeComponent(
  "dev:booking.form", 
  ".default", 
  array(
    "SUCCESS_TEXT" => "Спасибо!",
    "COMPONENT_TEMPLATE" => ".default"
  ),
  false
);?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
serginhold, 2019-02-18
@serginhold

Judging by the CBitrixComponent sources, this is not provided,
so you can upd. still found it

CComponentUtil::GetComponentProps($componentName, $arCurrentValues = array(), $templateProperties = array())

T
Trionik, 2021-06-24
@Trionik

serginhold serginhold @serginhold
судя по исходникам CBitrixComponent это не предусмотрено,
так что можно руками
include __DIR__ . '/.parameters.php';

doesn't work, in class.php the arParams array is empty.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question