Habari\Term::__construct PHP Метод

__construct() публичный Метод

Term constructor Creates a Term instance
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial term values
    public function __construct($paramarray = array())
    {
        // Defaults
        $this->fields = array_merge(self::default_fields(), $this->fields);
        if (is_string($paramarray)) {
            $paramarray = array('term_display' => $paramarray, 'term' => Utils::slugify($paramarray));
        }
        parent::__construct($paramarray);
        // TODO does term need to be a slug ?
        // TODO How should we handle neither being present ?
        // A Vocabulary may be used for organization, display, or both.
        // Therefore, a Term can be constructed with a term, term_display, or both
        if ($this->term == '') {
            $this->fields['term'] = Utils::slugify($this->fields['term_display']);
        }
        $this->exclude_fields('id');
    }