protected function getRelatedDocumentsGridField()
    {
        $gridField = GridField::create(
            'RelatedDocuments',
            _t('DMSDocument.RELATEDDOCUMENTS', 'Related Documents'),
            $this->RelatedDocuments(),
            new GridFieldConfig_RelationEditor
        );

        $gridFieldConfig = $gridField->getConfig();
        $gridFieldConfig->removeComponentsByType('GridFieldEditButton');
        $gridFieldConfig->addComponent(new DMSGridFieldEditButton(), 'GridFieldDeleteAction');

        $gridField->getConfig()->removeComponentsByType('GridFieldAddNewButton');
        // Move the autocompleter to the left
        $gridField->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
        $gridField->getConfig()->addComponent(
            $addExisting = new GridFieldAddExistingAutocompleter('buttons-before-left')
        );

        // Ensure that current document doesn't get returned in the autocompleter
        $addExisting->setSearchList($this->getRelatedDocumentsForAutocompleter());

        // Restrict search fields to specific fields only
        $addExisting->setSearchFields(array('Title:PartialMatch', 'Filename:PartialMatch'));
        $addExisting->setResultsFormat('$Filename');

        $this->extend('updateRelatedDocumentsGridField', $gridField);
        return $gridField;
    }
protected function getRelatedDocumentsGridField()
    {
        $gridField = GridField::create(
            'RelatedDocuments',
            _t('DMSDocument.RELATEDDOCUMENTS', 'Related Documents'),
            $this->RelatedDocuments(),
            new GridFieldConfig_RelationEditor
        );

        $gridFieldConfig = $gridField->getConfig();
        $gridFieldConfig->removeComponentsByType('GridFieldEditButton');
        $gridFieldConfig->addComponent(new DMSGridFieldEditButton(), 'GridFieldDeleteAction');

        $gridField->getConfig()->removeComponentsByType('GridFieldAddNewButton');
        // Move the autocompleter to the left
        $gridField->getConfig()->removeComponentsByType('GridFieldAddExistingAutocompleter');
        $gridField->getConfig()->addComponent(
            $addExisting = new GridFieldAddExistingAutocompleter('buttons-before-left')
        );

        // Ensure that current document doesn't get returned in the autocompleter
        $addExisting->setSearchList($this->getRelatedDocumentsForAutocompleter());

        // Restrict search fields to specific fields only
        $addExisting->setSearchFields(array('Title:PartialMatch', 'Filename:PartialMatch'));
        $addExisting->setResultsFormat('$Filename');

        $this->extend('updateRelatedDocumentsGridField', $gridField);
        return $gridField;
    }
protected function getRelatedDocumentsGridField ( ) { $ gridField = GridField :: create ( 'RelatedDocuments' , _t ( 'DMSDocument.RELATEDDOCUMENTS' , 'Related Documents' ) , $ this -> RelatedDocuments ( ) , new GridFieldConfig_RelationEditor ) ; $ gridFieldConfig = $ gridField -> getConfig ( ) ; $ gridFieldConfig -> removeComponentsByType ( 'GridFieldEditButton' ) ; $ gridFieldConfig -> addComponent ( new DMSGridFieldEditButton ( ) , 'GridFieldDeleteAction' ) ; $ gridField -> getConfig ( ) -> removeComponentsByType ( 'GridFieldAddNewButton' ) ; // Move the autocompleter to the left $ gridField -> getConfig ( ) -> removeComponentsByType ( 'GridFieldAddExistingAutocompleter' ) ; $ gridField -> getConfig ( ) -> addComponent ( $ addExisting = new GridFieldAddExistingAutocompleter ( 'buttons-before-left' ) ) ; // Ensure that current document doesn't get returned in the autocompleter $ addExisting -> setSearchList ( $ this -> getRelatedDocumentsForAutocompleter ( ) ) ; // Restrict search fields to specific fields only $ addExisting -> setSearchFields ( array ( 'Title:PartialMatch' , 'Filename:PartialMatch' ) ) ; $ addExisting -> setResultsFormat ( '$Filename' ) ; $ this -> extend ( 'updateRelatedDocumentsGridField' , $ gridField ) ; return $ gridField ; }
Get a GridField for managing related documents

@return GridField
Get a GridField for managing related documents