original_string: protected function validateTypeCollection()
      {
          $field = 'type';
  
          if ($this->isExcluded($field) || $this->isUpdating()) {
              return null; // Do not check type on update - it cannot be changed and will be ignored
          }
  
          $value = $this->getSubmitted($field);
          $label = $this->translation->text('Type');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          $types = $this->collection->getTypes();
  
          if (!isset($types[$value])) {
              $this->setErrorUnavailable($field, $label);
              return false;
          }
  
          return true;
      }
code: protected function validateTypeCollection()
      {
          $field = 'type';
  
          if ($this->isExcluded($field) || $this->isUpdating()) {
              return null; // Do not check type on update - it cannot be changed and will be ignored
          }
  
          $value = $this->getSubmitted($field);
          $label = $this->translation->text('Type');
  
          if (empty($value)) {
              $this->setErrorRequired($field, $label);
              return false;
          }
  
          $types = $this->collection->getTypes();
  
          if (!isset($types[$value])) {
              $this->setErrorUnavailable($field, $label);
              return false;
          }
  
          return true;
      }
code_tokens: protected function validateTypeCollection ( ) { $ field = 'type' ; if ( $ this -> isExcluded ( $ field ) || $ this -> isUpdating ( ) ) { return null ; // Do not check type on update - it cannot be changed and will be ignored } $ value = $ this -> getSubmitted ( $ field ) ; $ label = $ this -> translation -> text ( 'Type' ) ; if ( empty ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } $ types = $ this -> collection -> getTypes ( ) ; if ( ! isset ( $ types [ $ value ] ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } return true ; }
docstring: Validates collection type field
  @return boolean
docstring_tokens: Validates collection type field