code: protected function isPublishedItem($objMetaModel, $intItemId)
      {
          // Check publish state of an item.
          $statement = $this->connection
              ->prepare('SELECT colname FROM tl_metamodel_attribute WHERE pid=? AND check_publish=1 LIMIT 0,1');
  
          $statement->bindValue(1, $objMetaModel->get('id'));
          $statement->execute();
  
          if ($statement->rowCount() > 0) {
              $objAttrCheckPublish = $statement->fetch(\PDO::FETCH_OBJ);
              $objItem             = $objMetaModel->findById($intItemId);
  
              if (!$objItem->get($objAttrCheckPublish->colname)) {
                  return false;
              }
          }
  
          return true;
      }
docs: Check if the item is published.
  
  @param IMetaModel $objMetaModel Current metamodels.
  @param int        $intItemId    Id of the item.
  
  @return boolean True => Published | False => Not published
  
  @throws \Doctrine\DBAL\DBALException When a database error occur.