original_string: protected function validateEntityCollectionItem()
      {
          if ($this->isError()) {
              return null;
          }
  
          $collection = $this->getSubmitted('collection');
          $collection_id = $this->getSubmitted('collection_id');
  
          if (empty($collection)) {
  
              if (!isset($collection_id)) {
                  $updating = $this->getUpdating();
                  if (isset($updating['collection_id'])) {
                      $collection_id = $updating['collection_id'];
                  }
              }
  
              $collection = $this->collection->get($collection_id);
          }
  
          if (empty($collection['type'])) {
              $this->setErrorUnavailable('collection_id', $this->translation->text('Collection'));
              return false;
          }
  
          try {
              $entity_id = $this->getSubmitted('entity_id');
              $handlers = $this->collection->getHandlers();
              $result = static::call($handlers, $collection['type'], 'validate', array($entity_id));
          } catch (Exception $ex) {
              $result = $ex->getMessage();
          }
  
          if ($result === true) {
              return true;
          }
  
          $this->setError('entity_id', implode('<br>', (array) $result));
          return false;
      }
code: protected function validateEntityCollectionItem()
      {
          if ($this->isError()) {
              return null;
          }
  
          $collection = $this->getSubmitted('collection');
          $collection_id = $this->getSubmitted('collection_id');
  
          if (empty($collection)) {
  
              if (!isset($collection_id)) {
                  $updating = $this->getUpdating();
                  if (isset($updating['collection_id'])) {
                      $collection_id = $updating['collection_id'];
                  }
              }
  
              $collection = $this->collection->get($collection_id);
          }
  
          if (empty($collection['type'])) {
              $this->setErrorUnavailable('collection_id', $this->translation->text('Collection'));
              return false;
          }
  
          try {
              $entity_id = $this->getSubmitted('entity_id');
              $handlers = $this->collection->getHandlers();
              $result = static::call($handlers, $collection['type'], 'validate', array($entity_id));
          } catch (Exception $ex) {
              $result = $ex->getMessage();
          }
  
          if ($result === true) {
              return true;
          }
  
          $this->setError('entity_id', implode('<br>', (array) $result));
          return false;
      }
code_tokens: protected function validateEntityCollectionItem ( ) { if ( $ this -> isError ( ) ) { return null ; } $ collection = $ this -> getSubmitted ( 'collection' ) ; $ collection_id = $ this -> getSubmitted ( 'collection_id' ) ; if ( empty ( $ collection ) ) { if ( ! isset ( $ collection_id ) ) { $ updating = $ this -> getUpdating ( ) ; if ( isset ( $ updating [ 'collection_id' ] ) ) { $ collection_id = $ updating [ 'collection_id' ] ; } } $ collection = $ this -> collection -> get ( $ collection_id ) ; } if ( empty ( $ collection [ 'type' ] ) ) { $ this -> setErrorUnavailable ( 'collection_id' , $ this -> translation -> text ( 'Collection' ) ) ; return false ; } try { $ entity_id = $ this -> getSubmitted ( 'entity_id' ) ; $ handlers = $ this -> collection -> getHandlers ( ) ; $ result = static :: call ( $ handlers , $ collection [ 'type' ] , 'validate' , array ( $ entity_id ) ) ; } catch ( Exception $ ex ) { $ result = $ ex -> getMessage ( ) ; } if ( $ result === true ) { return true ; } $ this -> setError ( 'entity_id' , implode ( '<br>' , ( array ) $ result ) ) ; return false ; }
docstring: Validates collection item entities
  @return boolean|null
docstring_tokens: Validates collection item entities