<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace Kufer\KuferTools\Utils\WssField;

class WssFieldPersonAnredetitelAuswahl extends WssField
{
  public function getFieldName(): string
  {
    return 'name_titel'; 
                         
  }

  public function isValid($value, bool $checkPflichtfelder = true): bool
  {
    if ($value === '') {
      return true;
    }

    $dbwTitel = new \DBWorkTitel();

    return \in_array($value, $dbwTitel->getTitleNames());
  }
}