buildInput

@param array $attrs

@return  mixed
431049
public function buildInput($attrs)
    {
        $element = $this->element() ?: static::ELEMENT_BUTTON;

        if ($element === static::ELEMENT_BUTTON) {
            $attrs['type'] = $this->buttonType() ?: 'submit';
        }

        return new HtmlElement(
            $element,
            $this->getAttribute('text', $this->getValue()),
            $attrs
        );
    }
647436
protected function _buildAttribute($attr)
    {
        $string = array();

        foreach ($attr as $key => $value) {
            if (is_array($value)) {
                $value = implode(' ', $value);
            }

            $string[] = $key.'="'.$value.'"';
        }

        return implode(' ', $string);
    }
545002
private function repeatTagStartHandler(array $attrs): void
    {
        $this->process_repeats++;
        if ($this->process_repeats > 1) {
            return;
        }

        $this->repeats_stack[] = [$this->repeats, $this->repeat_bytes];
        $this->repeats         = [];
        $this->repeat_bytes    = xml_get_current_line_number($this->parser);

        $tag = $attrs['tag'] ?? '';
        if (!empty($tag)) {
            if ($tag === '@desc') {
                $value = $this->desc;
                $value = trim($value);
                $this->current_element->addText($value);
            } else {
                $tag   = str_replace('@fact', $this->fact, $tag);
                $tags  = explode(':', $tag);
                $temp  = explode(' ', trim($this->gedrec));
                $level = $temp[0];
                if ($level == 0) {
                    $level++;
                }
                $subrec = $this->gedrec;
                $t      = $tag;
                $count  = count($tags);
                $i      = 0;
                while ($i < $count) {
                    $t = $tags[$i];
                    if (!empty($t)) {
                        if ($i < ($count - 1)) {
                            $subrec = Functions::getSubRecord($level, "$level $t", $subrec);
                            if (empty($subrec)) {
                                $level--;
                                $subrec = Functions::getSubRecord($level, "@ $t", $this->gedrec);
                                if (empty($subrec)) {
                                    return;
                                }
                            }
                        }
                        $level++;
                    }
                    $i++;
                }
                $level--;
                $count = preg_match_all("/$level $t(.*)/", $subrec, $match, PREG_SET_ORDER);
                $i     = 0;
                while ($i < $count) {
                    $i++;
                    // Privacy check - is this a link, and are we allowed to view the linked object?
                    $subrecord = Functions::getSubRecord($level, "$level $t", $subrec, $i);
                    if (preg_match('/^\d ' . Gedcom::REGEX_TAG . ' @(' . Gedcom::REGEX_XREF . ')@/', $subrecord, $xref_match)) {
                        $linked_object = GedcomRecord::getInstance($xref_match[1], $this->tree);
                        if ($linked_object && !$linked_object->canShow()) {
                            continue;
                        }
                    }
                    $this->repeats[] = $subrecord;
                }
            }
        }
    }
12527
public function changed($attrs=false) 
    {
        $changes = array();
        $cls     = get_called_class();

        foreach (self::$_columns[$cls] as $column) {
            // if is the primary key or one of the automatic columns, skip
            if ($cls::getPK() == $column || in_array(strtolower($column), array("created_at","updated_at"))) {
                continue;
            }

            $cur = $this->get($column);         // current value
            $old = $this->get($column, false);  // old value

            // if same value, didn't change
            if ($cur == $old) {
                continue;
            }

            // set the value as the changed column name
            $value = $column;

            // if checking the attributes, return an array with both values
            if ($attrs) {
                $value = array($old, $cur);
                $changes[$column] = $value;
            } else {
                array_push($changes, $value);
            }
        }
        return $changes;
    }
605074
public static function script($src, array $attrs = [])
    {
        $attrs = array_merge([
            'src' => $src
        ], $attrs);

        return static::tag('script', null, $attrs);
    }
579455
public function create($name, $attrs = NULL)
	{
		$this->insert(NULL, $child = static::el($name, $attrs));

		return $child;
	}
1351412
public function build(HtmlView $view, array $attrs = null, array $ulAttrs = null, array $liAttrs = null, array $aAttrs = null) {
		$pageState = $view->lookup(PageState::class);
		CastUtils::assertTrue($pageState instanceof PageState);
		
		$navItemBuilder = null;
		if ($this->navItemBuilder === null) {
			$navItemBuilder = new CommonNavItemBuilder();
		} else if ($this->navItemBuilder instanceof NavItemBuilder) {
			$navItemBuilder = $this->navItemBuilder;
		} else {
			$navItemBuilder = $view->lookup($this->navItemBuilder);
			if (!($navItemBuilder instanceof NavItemBuilder)) {
				throw new UiException('Invalid NavItemBuilder: ' . $navItemBuilder);
			}
		}
		
		$navFactory = new NavFactory($navItemBuilder, $view->getN2nLocale(), $this->numLevels, $this->numOpenLevels);
		if ($pageState->hasCurrent()) {
			$navFactory->setCurrentNavBranch($pageState->getCurrentNavBranch());
		}
		$navFactory->setNumLevels($this->numLevels);
		$navFactory->setNumOpenLevels($this->numOpenLevels);
		$navFactory->setRootUlAttrs((array) $attrs);
		$navFactory->setUlAttrs((array) $ulAttrs);
		$navFactory->setLiAttrs((array) $liAttrs);
		$navFactory->setAAttrs((array) $aAttrs);
		
		$n2nLocale = $view->getN2nLocale();
		$navBranch = $this->navBranchCriteria->determine($pageState, $n2nLocale, $view->getN2nContext());
		$startLevel = 1;
		if ($this->absStartlevelNo !== null) {
			$startLevel = $this->absStartlevelNo - $navBranch->getLevel();
		} else if ($this->relStartLevelNo !== null) {
			$startLevel = $this->relStartLevelNo;
		}
		
		return $navFactory->create($view, $this->dertermineBases($navBranch, $startLevel));
	}
246257
protected function inputStartHandler(array $attrs): void
    {
        $this->text  = '';
        $this->input = [
            'name'    => $attrs['name'] ?? '',
            'type'    => $attrs['type'] ?? '',
            'lookup'  => $attrs['lookup'] ?? '',
            'options' => $attrs['options'] ?? '',
            'default' => '',
            'value'   => '',
        ];

        if (isset($attrs['default'])) {
            if ($attrs['default'] === 'NOW') {
                $this->input['default'] = Carbon::now()->format('d M Y');
            } else {
                $match = [];
                if (preg_match('/NOW([+\-]\d+)/', $attrs['default'], $match) > 0) {
                    $this->input['default'] = Carbon::now()->addDays((int) $match[1])->format('d M Y');
                } else {
                    $this->input['default'] = $attrs['default'];
                }
            }
        } elseif ($attrs['name'] === 'pageSize') {
            $this->input['default'] = app(LocaleInterface::class)->territory()->paperSize();
        }
    }
790468
public function addField($name, $attrs)
    {
        if (is_string($attrs)) {
            $attrs = ['type' => $attrs];
        }
        $attrs = array_intersect_key($attrs, $this->_fieldDefaults);
        $this->_fields[$name] = $attrs + $this->_fieldDefaults;

        return $this;
    }
508587
protected function varStartHandler(array $attrs): void
    {
        if (preg_match('/^I18N::number\((.+)\)$/', $attrs['var'], $match)) {
            $this->text .= I18N::number((int) $match[1]);
        } elseif (preg_match('/^I18N::translate\(\'(.+)\'\)$/', $attrs['var'], $match)) {
            $this->text .= I18N::translate($match[1]);
        } elseif (preg_match('/^I18N::translateContext\(\'(.+)\', *\'(.+)\'\)$/', $attrs['var'], $match)) {
            $this->text .= I18N::translateContext($match[1], $match[2]);
        } else {
            $this->text .= $attrs['var'];
        }
    }
1003076
public function assign($attrs)
    {
        foreach ($attrs as $key => $val) {
            if (property_exists($this, $key)) {
                $this->$key = $val;
            }
        }
    }
281948
public static function buildAttrs(array $attributes, array $cssClasses = []): string
    {
        $output = '';
        if ($cssClasses) {
            if (array_key_exists('class', $attributes) && $attributes['class']) {
                $attributes['class'] .= ' ' . implode(' ', $cssClasses);
            } else {
                $attributes['class'] = implode(' ', $cssClasses);
            }
        }
        foreach ($attributes as $key => $value) {
            $output .= ' ' . $key . ($value !== null ? '="' . str_replace('"', '\"', $value) . '"' : '');
        }
        return $output;
    }
817786
public static function buildAttributes($attribs)
    {
        $string = '';

        foreach ((array) $attribs as $key => $value) {
            if ($value === true) {
                $string .= ' ' . $key;

                continue;
            }

            if ($value === null || $value === false) {
                continue;
            }

            $string .= ' ' . $key . '=' . static::quote($value);
        }

        return $string;
    }
1091282
protected function buildAttributes(array $attributes)
    {
        $html = [];

        foreach ($attributes as $key => $value) {
            $html[] = $key.'="'.$value.'"';
        }

        return count($html) ? ' '.implode(' ', $html) : '';
    }
203568
private function escapeAttributes($attrs)
    {
        $script = '[';
        $first = true;
        foreach ($attrs as $name => $value) {
            if ($first) {
                $first = false;
            } else {
                $script .= ' ';
            }
            $script .= $name . '=' . self::escape($value);
        }
        $script .= ']';

        return $script;
    }
627618
public function attr(array $attributes)
    {
        $result = '';

        foreach ($attributes as $attribute => $value) {
            $result .= ' '.(is_int($attribute) ? $value : $attribute.'="'.str_replace('"', '&quot;', $value).'"');
        }

        return $result;
    }
1030619
public function addAttributes(array $attr)
    {
        foreach ($attr as $name => $value) {
            $this->setAttribute($name, $value);
        }

        return $this;
    }