Documentation

onDemosGetRepository

Event allows to update array of templates, displayed when creating new site or page. For example, allows deleting specific templates.

Parameters

Class Description Available from version
data Array of templates.

Important! This method is not suitable for adding new templates (see. template introduction). It is used only for correcting (for example, for categories) or deleting existing templates.

Examples

In an abstract example we delete a specific template from an array.

$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler('landing', 'onDemosGetRepository',
   function(\Bitrix\Main\Event $event)
   {
      $result = new \Bitrix\Main\Entity\EventResult;
      $data = $event->getParameter('data');

      unset($data['store-my']);

      $result->modifyFields(array(
         'data' => $data
      ));
      return $result;
   }
);


© «Bitrix24», 2001-2024