public function CroppableImageForm()
    {
        $image = $this->getCroppableImageObject();

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

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

        $image = null;
        if ($CroppableImageID = (int) $this->request->getVar('SaltedCroppableImageID')) {
            $image = SaltedCroppableImage::get()->byID($CroppableImageID);
        }
        $image = $image ? $image : singleton('SaltedCroppableImage');

        // $image->setAllowedTypes($this->getAllowedTypes());
        $fields = $image->getCMSFields();

        $title = $image ? _t('CroppableImageable.EDITIMAGE', 'Edit Image') : _t('CroppableImageable.ADDIMAGE', 'Add Image');
        $fields->insertBefore(HeaderField::create('CroppableImageHeader', $title), _t('CroppableImageable.TITLE', 'Title'));
        $actions = FieldList::create($action);
        $form = Form::create($this, 'CroppableImageForm', $fields, $actions);

        if ($image) {
            $form->loadDataFrom($image);
            if (!empty($this->folderName)) {
                $fields->fieldByName('Root.Main.Original')->setFolderName($this->folderName);
            }

            $fields->push(HiddenField::create('CropperRatio')->setValue($this->Ratio));
            $fields->push(HiddenField::create('ContainerX')->setValue($image->ContainerX));
            $fields->push(HiddenField::create('ContainerX')->setValue($image->ContainerX));
            $fields->push(HiddenField::create('ContainerY')->setValue($image->ContainerY));
            $fields->push(HiddenField::create('ContainerWidth')->setValue($image->ContainerWidth));
            $fields->push(HiddenField::create('ContainerHeight')->setValue($image->ContainerHeight));
            $fields->push(HiddenField::create('CropperX')->setValue($image->CropperX));
            $fields->push(HiddenField::create('CropperY')->setValue($image->CropperY));
            $fields->push(HiddenField::create('CropperWidth')->setValue($image->CropperWidth));
            $fields->push(HiddenField::create('CropperHeight')->setValue($image->CropperHeight));
        }

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

        return $form;
    }
public function CroppableImageForm()
    {
        $image = $this->getCroppableImageObject();

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

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

        $image = null;
        if ($CroppableImageID = (int) $this->request->getVar('SaltedCroppableImageID')) {
            $image = SaltedCroppableImage::get()->byID($CroppableImageID);
        }
        $image = $image ? $image : singleton('SaltedCroppableImage');

        // $image->setAllowedTypes($this->getAllowedTypes());
        $fields = $image->getCMSFields();

        $title = $image ? _t('CroppableImageable.EDITIMAGE', 'Edit Image') : _t('CroppableImageable.ADDIMAGE', 'Add Image');
        $fields->insertBefore(HeaderField::create('CroppableImageHeader', $title), _t('CroppableImageable.TITLE', 'Title'));
        $actions = FieldList::create($action);
        $form = Form::create($this, 'CroppableImageForm', $fields, $actions);

        if ($image) {
            $form->loadDataFrom($image);
            if (!empty($this->folderName)) {
                $fields->fieldByName('Root.Main.Original')->setFolderName($this->folderName);
            }

            $fields->push(HiddenField::create('CropperRatio')->setValue($this->Ratio));
            $fields->push(HiddenField::create('ContainerX')->setValue($image->ContainerX));
            $fields->push(HiddenField::create('ContainerX')->setValue($image->ContainerX));
            $fields->push(HiddenField::create('ContainerY')->setValue($image->ContainerY));
            $fields->push(HiddenField::create('ContainerWidth')->setValue($image->ContainerWidth));
            $fields->push(HiddenField::create('ContainerHeight')->setValue($image->ContainerHeight));
            $fields->push(HiddenField::create('CropperX')->setValue($image->CropperX));
            $fields->push(HiddenField::create('CropperY')->setValue($image->CropperY));
            $fields->push(HiddenField::create('CropperWidth')->setValue($image->CropperWidth));
            $fields->push(HiddenField::create('CropperHeight')->setValue($image->CropperHeight));
        }

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

        return $form;
    }
public function CroppableImageForm ( ) { $ image = $ this -> getCroppableImageObject ( ) ; $ action = FormAction :: create ( 'doSaveCroppableImage' , _t ( 'CroppableImageable.SAVE' , 'Save' ) ) -> setUseButtonTag ( 'true' ) ; if ( ! $ this -> isFrontend ) { $ action -> addExtraClass ( 'ss-ui-action-constructive' ) -> setAttribute ( 'data-icon' , 'accept' ) ; } $ image = null ; if ( $ CroppableImageID = ( int ) $ this -> request -> getVar ( 'SaltedCroppableImageID' ) ) { $ image = SaltedCroppableImage :: get ( ) -> byID ( $ CroppableImageID ) ; } $ image = $ image ? $ image : singleton ( 'SaltedCroppableImage' ) ; // $image->setAllowedTypes($this->getAllowedTypes()); $ fields = $ image -> getCMSFields ( ) ; $ title = $ image ? _t ( 'CroppableImageable.EDITIMAGE' , 'Edit Image' ) : _t ( 'CroppableImageable.ADDIMAGE' , 'Add Image' ) ; $ fields -> insertBefore ( HeaderField :: create ( 'CroppableImageHeader' , $ title ) , _t ( 'CroppableImageable.TITLE' , 'Title' ) ) ; $ actions = FieldList :: create ( $ action ) ; $ form = Form :: create ( $ this , 'CroppableImageForm' , $ fields , $ actions ) ; if ( $ image ) { $ form -> loadDataFrom ( $ image ) ; if ( ! empty ( $ this -> folderName ) ) { $ fields -> fieldByName ( 'Root.Main.Original' ) -> setFolderName ( $ this -> folderName ) ; } $ fields -> push ( HiddenField :: create ( 'CropperRatio' ) -> setValue ( $ this -> Ratio ) ) ; $ fields -> push ( HiddenField :: create ( 'ContainerX' ) -> setValue ( $ image -> ContainerX ) ) ; $ fields -> push ( HiddenField :: create ( 'ContainerX' ) -> setValue ( $ image -> ContainerX ) ) ; $ fields -> push ( HiddenField :: create ( 'ContainerY' ) -> setValue ( $ image -> ContainerY ) ) ; $ fields -> push ( HiddenField :: create ( 'ContainerWidth' ) -> setValue ( $ image -> ContainerWidth ) ) ; $ fields -> push ( HiddenField :: create ( 'ContainerHeight' ) -> setValue ( $ image -> ContainerHeight ) ) ; $ fields -> push ( HiddenField :: create ( 'CropperX' ) -> setValue ( $ image -> CropperX ) ) ; $ fields -> push ( HiddenField :: create ( 'CropperY' ) -> setValue ( $ image -> CropperY ) ) ; $ fields -> push ( HiddenField :: create ( 'CropperWidth' ) -> setValue ( $ image -> CropperWidth ) ) ; $ fields -> push ( HiddenField :: create ( 'CropperHeight' ) -> setValue ( $ image -> CropperHeight ) ) ; } $ this -> owner -> extend ( 'updateLinkForm' , $ form ) ; return $ form ; }
The CroppableImageForm for the dialog window

@return Form
The CroppableImageForm for the dialog window