Nestable\Services\NestableService::doActive PHP Метод

doActive() защищенный Метод

Insert all saved attributes to
  • element.
  • protected doActive ( array $href, string $label ) : string
    $href array
    $label string
    Результат string
        protected function doActive($href, $label)
        {
            if (is_array($this->active) && array_key_exists('callback', $this->active)) {
                $this->active = $this->active['callback'];
            }
            if ($this->active) {
                // Find active path in array
                if (is_array($this->active) && count($this->active) > 0) {
                    $result = array_search($href, $this->active);
                    if ($result !== false) {
                        unset($this->active[$result]);
                        return 'class="active"';
                    }
                } elseif ($this->active instanceof Closure) {
                    call_user_func_array($this->active, [$this, $href, $label]);
                    $attrs = $this->renderAttr($this->optionAttr);
                    $this->optionAttr = null;
                    return $attrs;
                } else {
                    if ($this->active == $href) {
                        $this->active = null;
                        return 'class="active"';
                    }
                }
            }
        }