<commit_before><?php

namespace SilverStripe\DataObjectPreview\Extensions;

use SilverStripe\Control\Controller;
use SilverStripe\Core\Extension;
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\Forms\LiteralField;

class PreviewGridFieldDetailFormExtension extends Extension
{
    public function updateItemEditForm(&$form)
    {
        $fields = $form->Fields();
        if ($this->owner->record instanceof CMSPreviewable && !$fields->fieldByName('SilverStripeNavigator'))
        {
            $fields->removeByName('SilverStripeNavigator');
            $ctrl = Controller::curr();
            $navigator = new SilverStripeNavigator($this->owner->record);
            $field = new LiteralField('SilverStripeNavigator', $navigator->renderWith($ctrl->getTemplatesWithSuffix('_SilverStripeNavigator')));
            $field->setAllowHTML(true);
            $fields->push($field);
            $form->addExtraClass('cms-previewable');
            $form->addExtraClass('cms-previewabledataobject');
            $form->removeExtraClass('cms-panel-padded center');
        }
    }
}<commit_msg>remove Navigator from ModelAdmin instances<commit_after><?php

namespace SilverStripe\DataObjectPreview\Extensions;

use SilverStripe\Admin\ModelAdmin;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Extension;
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
use SilverStripe\ORM\CMSPreviewable;
use SilverStripe\Forms\LiteralField;

class PreviewGridFieldDetailFormExtension extends Extension
{
    public function updateItemEditForm(&$form)
    {
        $fields = $form->Fields();
        if ($this->owner->record instanceof CMSPreviewable && !$fields->fieldByName('SilverStripeNavigator'))
        {
            $fields->removeByName('SilverStripeNavigator');
            $ctrl = Controller::curr();
            if(!$ctrl instanceof ModelAdmin){
                $navigator = new SilverStripeNavigator($this->owner->record);
                $field = new LiteralField('SilverStripeNavigator', $navigator->renderWith($ctrl->getTemplatesWithSuffix('_SilverStripeNavigator')));
                $field->setAllowHTML(true);
                $fields->push($field);
                $form->addExtraClass('cms-previewable');
                $form->addExtraClass('cms-previewabledataobject');
                $form->removeExtraClass('cms-panel-padded center');
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.12194127243066884, 'fraction_numerical': 0.0, 'mean_word_length': 3.5174953959484347, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6812036', 'n_tokens_mistral': 703, 'n_tokens_neox': 680, 'n_words': 95}