A
A
Ambal892017-03-10 12:04:47
1C-Bitrix
Ambal89, 2017-03-10 12:04:47

How to hide a section element without deactivating it?

Good afternoon! Please tell me, in Bitrix I have a section, and there is an element in it. It is necessary that the element be accessible by link, but not displayed in the section. If you deactivate it, then it is also unavailable via the link.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlaka, 2017-03-10
@Ambal89

Create a new element property, for example: hide_in_section_page
This property is a flag. Behavior logic: if it is not set, the element is shown (where you need it), if it is set, it is not shown. For example, let it be a numeric field. If empty or zero == the flag is not set, if it is one, the flag is set.
On the page with a list of elements in the component settings, you specify in which variable the additional filter will be stored. This variable is passed an array that will be glued to the filter that is passed to CIBlockElement::GetList .
Let there be a variable set in the component's default parameters: arFilter .
Before calling the component, you need to initialize the array.
For our case:

$GLOBALS[ 'arFilter' ]= array(
  '!PROPERTY_hide_in_section_page' => 1
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question