protected function getDataGridConfigCode(): string
    {
        if ($this->family) {
            // If datagrid code set in options, use it
            $familyCode = $this->family->getCode();
            /* @noinspection UnSafeIsSetOverArrayInspection */
            if (isset($this->admin->getOption('families')[$familyCode]['datagrid'])) {
                return $this->admin->getOption('families')[$familyCode]['datagrid'];
            }

            // Check if family has a datagrid with the same name
            if ($this->get(DataGridRegistry::class)->hasDataGrid($familyCode)) {
                return $familyCode;
            }
            // Check in lowercase (this should be deprecated ?)
            $code = strtolower($familyCode);
            if ($this->get(DataGridRegistry::class)->hasDataGrid($code)) {
                return $code;
            }
        }

        return parent::getDataGridConfigCode();
    }