original_string: public function isRequired($field)
      {
          $parts = explode('.', $field);
          $entity = $this->entity($parts);
  
          $isNew = true;
          if ($entity instanceof EntityInterface) {
              $isNew = $entity->isNew();
          }
  
          $validator = $this->_getValidator($parts);
          $fieldName = array_pop($parts);
          if (!$validator->hasField($fieldName)) {
              return false;
          }
          if ($this->type($field) !== 'boolean') {
              return $validator->isEmptyAllowed($fieldName, $isNew) === false;
          }
  
          return false;
      }
code: public function isRequired($field)
      {
          $parts = explode('.', $field);
          $entity = $this->entity($parts);
  
          $isNew = true;
          if ($entity instanceof EntityInterface) {
              $isNew = $entity->isNew();
          }
  
          $validator = $this->_getValidator($parts);
          $fieldName = array_pop($parts);
          if (!$validator->hasField($fieldName)) {
              return false;
          }
          if ($this->type($field) !== 'boolean') {
              return $validator->isEmptyAllowed($fieldName, $isNew) === false;
          }
  
          return false;
      }
code_tokens: public function isRequired ( $ field ) { $ parts = explode ( '.' , $ field ) ; $ entity = $ this -> entity ( $ parts ) ; $ isNew = true ; if ( $ entity instanceof EntityInterface ) { $ isNew = $ entity -> isNew ( ) ; } $ validator = $ this -> _getValidator ( $ parts ) ; $ fieldName = array_pop ( $ parts ) ; if ( ! $ validator -> hasField ( $ fieldName ) ) { return false ; } if ( $ this -> type ( $ field ) !== 'boolean' ) { return $ validator -> isEmptyAllowed ( $ fieldName , $ isNew ) === false ; } return false ; }
docstring: Check if a field should be marked as required.
  
  @param string $field The dot separated path to the field you want to check.
  @return bool
docstring_tokens: Check if a field should be marked as required .