40 public function set(array $templates)
42 $templateList = \Bitrix\Iblock\InheritedPropertyTable::getList(array(
43 "select" => array(
"ID",
"CODE",
"TEMPLATE"),
45 "=IBLOCK_ID" => $this->entity->getIblockId(),
46 "=ENTITY_TYPE" => $this->entity->getType(),
47 "=ENTITY_ID" => $this->entity->getId(),
50 array_map(
"trim", $templates);
51 while ($row = $templateList->fetch())
54 if (array_key_exists($CODE, $templates))
56 if ($templates[$CODE] !== $row[
"TEMPLATE"])
58 if ($templates[$CODE] !=
"")
59 \Bitrix\Iblock\InheritedPropertyTable::update($row[
"ID"], array(
60 "TEMPLATE" => $templates[$CODE],
63 \Bitrix\Iblock\InheritedPropertyTable::delete($row[
"ID"]);
65 $this->entity->deleteValues($row[
"ID"]);
67 unset($templates[$CODE]);
71 if (!empty($templates))
73 foreach ($templates as $CODE => $TEMPLATE)
77 \Bitrix\Iblock\InheritedPropertyTable::add(array(
78 "IBLOCK_ID" => $this->entity->getIblockId(),
80 "ENTITY_TYPE" => $this->entity->getType(),
81 "ENTITY_ID" => $this->entity->getId(),
82 "TEMPLATE" => $TEMPLATE,
86 $this->entity->clearValues();
158 public function delete()
160 $templateList = \Bitrix\Iblock\InheritedPropertyTable::getList(array(
161 "select" => array(
"ID"),
163 "=IBLOCK_ID" => $this->entity->getIblockId(),
164 "=ENTITY_TYPE" => $this->entity->getType(),
165 "=ENTITY_ID" => $this->entity->getId(),
169 while ($row = $templateList->fetch())
171 \Bitrix\Iblock\InheritedPropertyTable::delete($row[
"ID"]);