public function performReadonlyTransformation()
    {
        $copy = clone $this;
        $copy->setReadonly(true);
        $copyConfig = $copy->getConfig();

        // get the whitelist for allowable readonly components
        $allowedComponents = $this->getReadonlyComponents();
        foreach ($this->getConfig()->getComponents() as $component) {
            // if a component doesn't exist, remove it from the readonly version.
            if (!in_array(get_class($component), $allowedComponents)) {
                $copyConfig->removeComponent($component);
            }
        }

        // As the edit button may have been removed, add a view button if it doesn't have one
        if (!$copyConfig->getComponentByType(GridFieldViewButton::class)) {
            $copyConfig->addComponent(new GridFieldViewButton);
        }

        return $copy;
    }