public function build($field)
    {
        $return = '';
        if (\is_array($field)) {
            $field = $this->fieldFactory->build($field);
        }
        $this->field = $field;
        $this->props = $field->props;
        $id = $field->getId();
        $isBuilding = \in_array($id, $this->building);
        $uniqueId = $field->getUniqueId(!$isBuilding);
        $this->setIds($uniqueId);
        if (!$isBuilding) {
            $this->building[] = $id;
        }
        $this->addAttributes();
        if (!$isBuilding) {
            $return = $field->doBuild();
        }
        if (!$return) {
            $return = $this->doBuild();
        }
        $return = $this->removeEmptyTags($return);
        $key = \array_search($id, $this->building);
        if ($key !== false) {
            unset($this->building[$key]);
        }
        return $return;
    }