public function isRequired($field)
{
$parts = explode('.', $field);
$entity = $this->entity($parts);
$isNew = true;
if ($entity instanceof Document) {
$isNew = $entity->isNew();
}
$validator = $this->getValidator();
$field = array_pop($parts);
if (!$validator->hasField($field)) {
return false;
}
if ($this->type($field) !== 'boolean') {
return $validator->isEmptyAllowed($field, $isNew) === false;
}
return false;
}