public function adapt(Grid &$grid)
    {
        $this->grid   = $grid;
        $customfields = app('customfields')->get();
        if (empty($customfields)) {
            return;
        }
        foreach ($customfields as $classname => $customfield) {

            if (is_array($grid->row)) {
                continue;
            }
            if (get_class($grid->row) !== $classname) {
                continue;
            }
            if (!is_array($customfield)) {
                $customfield = [$customfield];
            }

            foreach ($customfield as $instance) {
                if (!is_object($instance)) {
                    continue;
                }

                $this->addToForm($instance);
            }
        }



        if (extension_active('customfields')) {
            $map   = config('antares/customfields::map', []);
            $types = [];
            foreach ($map as $type => $classnames) {
                foreach ($classnames as $classname) {

                    if (is_array($this->grid->row)) {
                        continue;
                    }
                    if (get_class($this->grid->row) !== $classname) {
                        continue;
                    }
                    array_push($types, $type);
                }
            }
            if (!empty($types)) {
                $this->getFields($types);
            }
        }
    }