Documentation

isPublic

Attention! We strongly recommend first to learn more about Sites module REST documentation to understand how the module functions (with REST available in Bitrix24 Self-hosted editions). View this documentation as useful source when working with Bitrix24 Self-hosted editions and find out more details about API and only REST is not enough.

public function isPublic(
)

Method returns block publication flag (true/false). This flag ideologically is readonly. Because when publishing a draft page version, each block will have the mode $block->isPublic() = false. When publishing a finished page, it has the same public status.

Parameters

No parameters.

Example

if (\Bitrix\Main\Loader::includeModule('landing'))
{
   \Bitrix\Landing\Landing::setEditMode(true);

   $landing = \Bitrix\Landing\Landing::createInstance(
      1
   );
   if ($landing->exist())
   {
      foreach ($landing->getBlocks() as $block)
      {
         if ($block->getId() == 45013)
         {
            var_dump($block->isPublic());
         }
      }
   }


   foreach ($landing->getError()->getErrors() as $error)
   {
      echo $error->getCode() . ': ';
      echo $error->getMessage();
      echo "\n";
   }
}


© «Bitrix24», 2001-2024