public function LinkForm()
    {
        $this->getLinkObject();

        $action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))
            ->setUseButtonTag('true');

        if (!$this->isFrontend) {
            $action
                ->addExtraClass('ss-ui-action-constructive')
                ->setAttribute('data-icon', 'accept');
        }

        $link = null;
        if ($linkID = (int)$this->request->getVar('LinkID')) {
            $link = Link::get()->byID($linkID);
        }

        $link = $link ? $link : singleton(Link::class);
        $link->setAllowedTypes($this->getAllowedTypes());

        /** @var $fields FieldList */
        $fields = $link->getCMSFields();

        $title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link');
        $fields->insertBefore(
            _t('Linkable.TITLE', 'Title'), HeaderField::create('LinkHeader', $title)
        );

        $actions = FieldList::create($action);
        $form = Form::create($this, 'LinkForm', $fields, $actions);

        if ($link) {
            $form->loadDataFrom($link);
            $fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
        }

        $this->owner->extend('updateLinkForm', $form);

        return $form;
    }
public function LinkForm()
    {
        $this->getLinkObject();

        $action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))
            ->setUseButtonTag('true');

        if (!$this->isFrontend) {
            $action
                ->addExtraClass('ss-ui-action-constructive')
                ->setAttribute('data-icon', 'accept');
        }

        $link = null;
        if ($linkID = (int)$this->request->getVar('LinkID')) {
            $link = Link::get()->byID($linkID);
        }

        $link = $link ? $link : singleton(Link::class);
        $link->setAllowedTypes($this->getAllowedTypes());

        /** @var $fields FieldList */
        $fields = $link->getCMSFields();

        $title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link');
        $fields->insertBefore(
            _t('Linkable.TITLE', 'Title'), HeaderField::create('LinkHeader', $title)
        );

        $actions = FieldList::create($action);
        $form = Form::create($this, 'LinkForm', $fields, $actions);

        if ($link) {
            $form->loadDataFrom($link);
            $fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
        }

        $this->owner->extend('updateLinkForm', $form);

        return $form;
    }
public function LinkForm ( ) { $ this -> getLinkObject ( ) ; $ action = FormAction :: create ( 'doSaveLink' , _t ( 'Linkable.SAVE' , 'Save' ) ) -> setUseButtonTag ( 'true' ) ; if ( ! $ this -> isFrontend ) { $ action -> addExtraClass ( 'ss-ui-action-constructive' ) -> setAttribute ( 'data-icon' , 'accept' ) ; } $ link = null ; if ( $ linkID = ( int ) $ this -> request -> getVar ( 'LinkID' ) ) { $ link = Link :: get ( ) -> byID ( $ linkID ) ; } $ link = $ link ? $ link : singleton ( Link :: class ) ; $ link -> setAllowedTypes ( $ this -> getAllowedTypes ( ) ) ; /** @var $fields FieldList */ $ fields = $ link -> getCMSFields ( ) ; $ title = $ link ? _t ( 'Linkable.EDITLINK' , 'Edit Link' ) : _t ( 'Linkable.ADDLINK' , 'Add Link' ) ; $ fields -> insertBefore ( _t ( 'Linkable.TITLE' , 'Title' ) , HeaderField :: create ( 'LinkHeader' , $ title ) ) ; $ actions = FieldList :: create ( $ action ) ; $ form = Form :: create ( $ this , 'LinkForm' , $ fields , $ actions ) ; if ( $ link ) { $ form -> loadDataFrom ( $ link ) ; $ fields -> push ( HiddenField :: create ( 'LinkID' , 'LinkID' , $ link -> ID ) ) ; } $ this -> owner -> extend ( 'updateLinkForm' , $ form ) ; return $ form ; }
The LinkForm for the dialog window

@return Form
The LinkForm for the dialog window