2012-07-16 22:39:01 +02:00
|
|
|
<?php
|
2012-07-18 14:23:51 +02:00
|
|
|
/**
|
|
|
|
* Handles request from the GridFieldBulkImageUpload component
|
|
|
|
*
|
|
|
|
* Handles:
|
|
|
|
* * Form creation
|
|
|
|
* * file upload
|
|
|
|
* * editing and cancelling records
|
2012-08-07 22:51:54 +02:00
|
|
|
*
|
|
|
|
* @author colymba
|
|
|
|
* @package GridFieldBulkEditingTools
|
2012-07-18 14:23:51 +02:00
|
|
|
*/
|
2012-07-16 22:39:01 +02:00
|
|
|
class GridFieldBulkImageUpload_Request extends RequestHandler {
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var GridField
|
|
|
|
*/
|
|
|
|
protected $gridField;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var GridField_URLHandler
|
|
|
|
*/
|
|
|
|
protected $component;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @var Controller
|
|
|
|
*/
|
|
|
|
protected $controller;
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
/**
|
2012-07-18 14:23:51 +02:00
|
|
|
* Cache the records FieldList from getCMSfields()
|
|
|
|
*
|
2012-07-18 01:12:10 +02:00
|
|
|
* @var FieldList
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
2012-07-18 01:12:10 +02:00
|
|
|
protected $recordCMSFieldList;
|
2012-07-16 22:39:01 +02:00
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2012-07-16 22:39:01 +02:00
|
|
|
static $url_handlers = array(
|
2012-08-07 23:02:13 +02:00
|
|
|
'$Action!' => '$Action'
|
2012-07-16 22:39:01 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param GridFIeld $gridField
|
|
|
|
* @param GridField_URLHandler $component
|
|
|
|
* @param Controller $controller
|
|
|
|
*/
|
|
|
|
public function __construct($gridField, $component, $controller) {
|
|
|
|
$this->gridField = $gridField;
|
|
|
|
$this->component = $component;
|
2012-07-18 01:12:10 +02:00
|
|
|
$this->controller = $controller;
|
2012-07-16 22:39:01 +02:00
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the URL for this RequestHandler
|
2012-07-18 01:12:10 +02:00
|
|
|
*
|
2012-07-18 14:23:51 +02:00
|
|
|
* @author SilverStripe
|
|
|
|
* @see GridFieldDetailForm_ItemRequest
|
|
|
|
* @param string $action
|
|
|
|
* @return string
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
|
|
|
public function Link($action = null) {
|
|
|
|
return Controller::join_links($this->gridField->Link(), 'bulkimageupload', $action);
|
|
|
|
}
|
2012-07-18 01:12:10 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the name of the Image field name from the managed record
|
|
|
|
* Either as set in the component config or the default one
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getRecordImageField()
|
|
|
|
{
|
2012-07-28 13:17:19 +02:00
|
|
|
$fieldName = $this->component->getConfig('imageFieldName');
|
2012-07-18 01:12:10 +02:00
|
|
|
if ( $fieldName == null ) $fieldName = $this->getDefaultRecordImageField();
|
|
|
|
|
|
|
|
return $fieldName;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of editable fields from the managed record
|
|
|
|
* Either as set in the component config or the default ones
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
function getRecordEditableFields()
|
|
|
|
{
|
2012-07-28 13:17:19 +02:00
|
|
|
$fields = $this->component->getConfig('editableFields');
|
2012-07-18 01:12:10 +02:00
|
|
|
if ( $fields == null ) $fields = $this->getDefaultRecordEditableFields();
|
|
|
|
|
|
|
|
return $fields;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the first has_one Image realtion from the GridField managed DataObject
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getDefaultRecordImageField()
|
|
|
|
{
|
|
|
|
$recordClass = $this->gridField->list->dataClass;
|
|
|
|
$recordHasOneFields = Config::inst()->get($recordClass, 'has_one', Config::UNINHERITED);
|
|
|
|
|
|
|
|
$imageField = null;
|
|
|
|
foreach( $recordHasOneFields as $field => $type )
|
|
|
|
{
|
|
|
|
if ( $type == 'Image' ) {
|
|
|
|
$imageField = $field . 'ID';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $imageField;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-08-07 23:02:13 +02:00
|
|
|
*
|
|
|
|
* @param type $recordID
|
|
|
|
* @return type
|
2012-07-18 01:12:10 +02:00
|
|
|
*/
|
2012-07-28 13:17:19 +02:00
|
|
|
function getRecordHTMLFormFields( $recordID = 0 )
|
|
|
|
{
|
|
|
|
$config = $this->component->getConfig();
|
2012-08-07 22:51:54 +02:00
|
|
|
$recordCMSDataFields = GridFieldBulkEditingHelper::getModelCMSDataFields( $config, $this->gridField->list->dataClass );
|
2012-07-28 13:17:19 +02:00
|
|
|
|
|
|
|
//@TODO: if editableFields given use them with filterNonEditableRecordsFields()
|
|
|
|
// otherwise go through getModelFilteredDataFields
|
|
|
|
|
|
|
|
|
2012-08-07 22:51:54 +02:00
|
|
|
$recordCMSDataFields = GridFieldBulkEditingHelper::filterNonEditableRecordsFields($config, $recordCMSDataFields);
|
2012-07-28 13:17:19 +02:00
|
|
|
|
|
|
|
if ( $config['imageFieldName'] == null ) $config['imageFieldName'] = $this->getDefaultRecordImageField();
|
|
|
|
|
2012-08-07 22:51:54 +02:00
|
|
|
$recordCMSDataFields = GridFieldBulkEditingHelper::getModelFilteredDataFields($config, $recordCMSDataFields);
|
|
|
|
$formFieldsHTML = GridFieldBulkEditingHelper::dataFieldsToHTML($recordCMSDataFields);
|
|
|
|
$formFieldsHTML = GridFieldBulkEditingHelper::escapeFormFieldsHTML($formFieldsHTML, $recordID);
|
2012-07-28 13:17:19 +02:00
|
|
|
|
|
|
|
return $formFieldsHTML;
|
|
|
|
}
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
/**
|
|
|
|
* Default and main action that returns the upload form etc...
|
2012-07-18 14:23:51 +02:00
|
|
|
*
|
|
|
|
* @return string Form's HTML
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
2012-07-18 01:12:10 +02:00
|
|
|
public function index()
|
|
|
|
{
|
2012-07-16 22:39:01 +02:00
|
|
|
Requirements::javascript(FRAMEWORK_DIR . '/javascript/AssetUploadField.js');
|
2012-07-18 10:57:01 +02:00
|
|
|
Requirements::css(FRAMEWORK_DIR . '/css/AssetUploadField.css');
|
2012-07-16 22:39:01 +02:00
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
$crumbs = $this->Breadcrumbs();
|
|
|
|
if($crumbs && $crumbs->count()>=2) $one_level_up = $crumbs->offsetGet($crumbs->count()-2);
|
2012-07-16 22:39:01 +02:00
|
|
|
|
|
|
|
$actions = new FieldList();
|
|
|
|
|
|
|
|
$html = "
|
|
|
|
<a id=\"bulkImageUploadUpdateBtn\" class=\"cms-panel-link action ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary\" data-icon=\"accept\" data-url=\"".$this->Link('update')."\" href=\"#\">
|
|
|
|
Save All
|
|
|
|
</a>";
|
|
|
|
$actions->push(new LiteralField('savebutton', $html));
|
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
|
|
|
|
if($crumbs && $crumbs->count()>=2)
|
|
|
|
{
|
2012-07-16 22:39:01 +02:00
|
|
|
$html = "
|
|
|
|
<a id=\"bulkImageUploadUpdateFinishBtn\" class=\"cms-panel-link action ss-ui-action-constructive ss-ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary\" data-icon=\"accept\" data-url=\"".$this->Link('update')."\" href=\"".$one_level_up->Link."\">
|
|
|
|
Save All & Finish
|
|
|
|
</a>";
|
|
|
|
$actions->push(new LiteralField('finishbutton', $html));
|
2012-07-18 01:12:10 +02:00
|
|
|
}
|
2012-07-25 19:59:50 +02:00
|
|
|
|
|
|
|
$html = "
|
|
|
|
<a id=\"bulkImageUploadUpdateCancelBtn\" class=\"cms-panel-link delete ss-ui-action-destructive ss-ui-button ui-button ui-widget ui-state-default ui-button-text-icon-primary\" data-icon=\"decline\" data-url=\"".$this->Link('cancel')."\" href=\"#\">
|
|
|
|
Cancel & Delete All
|
|
|
|
</a>";
|
|
|
|
$actions->push(new LiteralField('cancelbutton', $html));
|
2012-07-16 22:39:01 +02:00
|
|
|
|
|
|
|
$uploadField = UploadField::create('BulkImageUploadField', '');
|
|
|
|
$uploadField->setConfig('previewMaxWidth', 40);
|
|
|
|
$uploadField->setConfig('previewMaxHeight', 30);
|
|
|
|
|
|
|
|
$uploadField->addExtraClass('ss-assetuploadfield');
|
|
|
|
$uploadField->removeExtraClass('ss-uploadfield');
|
|
|
|
|
|
|
|
$uploadField->setTemplate('AssetUploadField');
|
|
|
|
$uploadField->setConfig('downloadTemplateName','GridFieldBulkImageUpload_downloadtemplate');
|
|
|
|
|
|
|
|
|
|
|
|
$uploadField->setConfig('url', $this->Link('upload'));
|
|
|
|
|
2012-08-07 21:40:12 +02:00
|
|
|
//$uploadField->setFolderName(ASSETS_DIR);
|
2012-07-16 22:39:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
$form = new Form(
|
|
|
|
$this,
|
|
|
|
'bulkImageUploadForm',
|
|
|
|
new FieldList(
|
|
|
|
$uploadField
|
|
|
|
),
|
|
|
|
$actions
|
|
|
|
);
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
$form->setTemplate('LeftAndMain_EditForm');
|
2012-07-18 01:12:10 +02:00
|
|
|
$form->addExtraClass('center cms-edit-form cms-content');
|
2012-07-16 22:39:01 +02:00
|
|
|
$form->setAttribute('data-pjax-fragment', 'CurrentForm Content');
|
|
|
|
|
|
|
|
if($crumbs && $crumbs->count()>=2){
|
|
|
|
$form->Backlink = $one_level_up->Link;
|
|
|
|
}
|
|
|
|
|
2012-07-19 14:48:17 +02:00
|
|
|
// this actually fixes the JS Requirements issue.
|
|
|
|
// Calling forTemplate() before other requirements forces SS to add the Form's X-Include-JS before
|
|
|
|
$formHTML = $form->forTemplate();
|
|
|
|
|
2012-08-07 22:56:59 +02:00
|
|
|
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload.js');
|
|
|
|
Requirements::css(BULK_EDIT_TOOLS_PATH . '/css/GridFieldBulkImageUpload.css');
|
|
|
|
Requirements::javascript(BULK_EDIT_TOOLS_PATH . '/javascript/GridFieldBulkImageUpload_downloadtemplate.js');
|
2012-07-18 10:57:01 +02:00
|
|
|
|
2012-07-19 14:48:17 +02:00
|
|
|
$response = new SS_HTTPResponse($formHTML);
|
2012-07-18 01:12:10 +02:00
|
|
|
$response->addHeader('Content-Type', 'text/plain');
|
2012-07-16 22:39:01 +02:00
|
|
|
$response->addHeader('X-Title', 'SilverStripe - Bulk '.$this->gridField->list->dataClass.' Image Upload');
|
2012-07-18 01:12:10 +02:00
|
|
|
return $response;
|
2012-07-16 22:39:01 +02:00
|
|
|
}
|
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
/**
|
|
|
|
* Process image upload and Object creation
|
|
|
|
* Create new DataObject and add image relation
|
|
|
|
* returns Image data and editable Fields forms
|
|
|
|
*
|
2012-07-18 14:23:51 +02:00
|
|
|
* Overides UploadField's upload method by Zauberfisch
|
|
|
|
* Kept original file upload/processing but removed unessesary processing
|
|
|
|
* and adds DataObject creation and editableFields processing
|
|
|
|
*
|
|
|
|
* @author Zauberfisch original upload() method
|
|
|
|
* @see UploadField->upload()
|
2012-07-18 01:12:10 +02:00
|
|
|
* @param SS_HTTPRequest $request
|
2012-07-18 14:23:51 +02:00
|
|
|
* @return string json
|
2012-07-18 01:12:10 +02:00
|
|
|
*/
|
2012-07-16 22:39:01 +02:00
|
|
|
public function upload(SS_HTTPRequest $request)
|
|
|
|
{
|
|
|
|
$recordClass = $this->gridField->list->dataClass;
|
|
|
|
$recordForeignKey = $this->gridField->list->foreignKey;
|
|
|
|
$recordForeignID = $this->gridField->list->foreignID;
|
|
|
|
|
|
|
|
$record = Object::create($recordClass);
|
|
|
|
$record->setField($recordForeignKey, $recordForeignID);
|
|
|
|
$record->write();
|
|
|
|
|
|
|
|
$upload = new Upload();
|
|
|
|
$tmpfile = $request->postVar('BulkImageUploadField');
|
|
|
|
|
|
|
|
// Check if the file has been uploaded into the temporary storage.
|
|
|
|
if (!$tmpfile) {
|
|
|
|
$return = array('error' => _t('UploadField.FIELDNOTSET', 'File information not found'));
|
|
|
|
} else {
|
|
|
|
$return = array(
|
|
|
|
'name' => $tmpfile['name'],
|
|
|
|
'size' => $tmpfile['size'],
|
|
|
|
'type' => $tmpfile['type'],
|
|
|
|
'error' => $tmpfile['error']
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Process the uploaded file
|
|
|
|
if (!$return['error']) {
|
|
|
|
$fileObject = Object::create('Image');
|
|
|
|
|
|
|
|
// Get the uploaded file into a new file object.
|
|
|
|
try {
|
2012-08-07 21:40:12 +02:00
|
|
|
$upload->loadIntoFile($tmpfile, $fileObject, $this->component->getConfig('folderName'));
|
2012-07-16 22:39:01 +02:00
|
|
|
} catch (Exception $e) {
|
|
|
|
// we shouldn't get an error here, but just in case
|
|
|
|
$return['error'] = $e->getMessage();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$return['error']) {
|
|
|
|
if ($upload->isError()) {
|
|
|
|
$return['error'] = implode(' '.PHP_EOL, $upload->getErrors());
|
|
|
|
} else {
|
|
|
|
$file = $upload->getFile();
|
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
// Attach the file to the related record.
|
|
|
|
$record->setField($this->getRecordImageField(), $file->ID);
|
2012-07-16 22:39:01 +02:00
|
|
|
$record->write();
|
|
|
|
|
2012-07-28 13:17:19 +02:00
|
|
|
//get record's CMS Fields
|
|
|
|
$recordEditableFormFields = $this->getRecordHTMLFormFields( $record->ID );
|
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
// Collect all output data.
|
|
|
|
$return = array_merge($return, array(
|
|
|
|
'id' => $file->ID,
|
|
|
|
'name' => $file->getTitle() . '.' . $file->getExtension(),
|
|
|
|
'url' => $file->getURL(),
|
|
|
|
'preview_url' => $file->setHeight(55)->Link(),
|
|
|
|
'thumbnail_url' => $file->SetRatioSize(40,30)->getURL(),
|
|
|
|
'size' => $file->getAbsoluteSize(),
|
|
|
|
//'buttons' => $file->UploadFieldFileButtons,
|
|
|
|
'record' => array(
|
|
|
|
'ID' => $record->ID,
|
2012-07-28 13:17:19 +02:00
|
|
|
'fields' => $recordEditableFormFields
|
2012-07-16 22:39:01 +02:00
|
|
|
)
|
|
|
|
));
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
$response = new SS_HTTPResponse(Convert::raw2json(array($return)));
|
|
|
|
$response->addHeader('Content-Type', 'text/plain');
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Update a record with the newly edited fields
|
|
|
|
*
|
|
|
|
* @param SS_HTTPRequest $request
|
2012-07-18 14:23:51 +02:00
|
|
|
* @return string
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
|
|
|
public function update(SS_HTTPRequest $request)
|
|
|
|
{
|
2012-07-18 01:12:10 +02:00
|
|
|
$data = $this->getParsedPostData($request->requestVars());
|
2012-07-16 22:39:01 +02:00
|
|
|
|
|
|
|
$recordClass = $this->gridField->list->dataClass;
|
2012-07-18 01:12:10 +02:00
|
|
|
$record = DataObject::get_by_id($recordClass, $data['ID']);
|
2012-07-16 22:39:01 +02:00
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
foreach($data as $field => $value)
|
2012-07-16 22:39:01 +02:00
|
|
|
{
|
|
|
|
$record->setField($field, $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
$record->write();
|
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
return '{done:1,recordID:'.$data['ID'].'}';
|
2012-07-16 22:39:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-18 01:12:10 +02:00
|
|
|
* Delete the Image Object and File as well as the DataObject
|
|
|
|
* according to the ID sent from the form
|
|
|
|
*
|
2012-07-16 22:39:01 +02:00
|
|
|
* @param SS_HTTPRequest $request
|
2012-07-18 14:23:51 +02:00
|
|
|
* @return string json
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
|
|
|
public function cancel(SS_HTTPRequest $request)
|
|
|
|
{
|
|
|
|
$data = $this->getParsedPostData($request->requestVars());
|
|
|
|
$return = array();
|
|
|
|
|
|
|
|
$recordClass = $this->gridField->list->dataClass;
|
|
|
|
$record = DataObject::get_by_id($recordClass, $data['ID']);
|
|
|
|
|
2012-07-18 01:12:10 +02:00
|
|
|
$imageField = $this->getRecordImageField();
|
2012-07-16 22:39:01 +02:00
|
|
|
$imageID = $record->$imageField;
|
|
|
|
$image = DataObject::get_by_id('Image', $imageID);
|
|
|
|
|
|
|
|
$return[$data['ID']]['imageID'] = $imageID;
|
|
|
|
$return[$data['ID']]['deletedDataObject'] = DataObject::delete_by_id($recordClass, $data['ID']);
|
|
|
|
|
|
|
|
$return[$data['ID']]['deletedFormattedImages'] = $image->deleteFormattedImages();
|
|
|
|
$return[$data['ID']]['deletedImageFile'] = unlink( Director::getAbsFile($image->getRelativePath()) );
|
|
|
|
|
|
|
|
|
|
|
|
$response = new SS_HTTPResponse(Convert::raw2json($return));
|
|
|
|
$response->addHeader('Content-Type', 'text/plain');
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-18 14:23:51 +02:00
|
|
|
* Simple function that replace the 'record_XX_' off of the ID field name
|
2012-07-18 01:12:10 +02:00
|
|
|
* prefix needed since it was taken for a pageID if sent as is as well as fixing other things
|
|
|
|
*
|
2012-07-16 22:39:01 +02:00
|
|
|
* @param array $data
|
|
|
|
* @return array
|
|
|
|
*/
|
2012-07-18 01:12:10 +02:00
|
|
|
function getParsedPostData(array $data)
|
2012-07-16 22:39:01 +02:00
|
|
|
{
|
|
|
|
$return = array();
|
|
|
|
|
|
|
|
foreach( $data as $key => $val)
|
|
|
|
{
|
2012-07-18 01:12:10 +02:00
|
|
|
$return[ preg_replace( '/record_(\d+)_(\w+)/i', '$2', $key) ] = $val;
|
2012-07-16 22:39:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-07-18 01:12:10 +02:00
|
|
|
* Add a unique prefix to sensitive HTML attributes (ID, FOR, NAME)
|
|
|
|
* Fixes rendering issue (i.e. dropdown fields) and IDs being mistaken for page IDs
|
2012-07-16 22:39:01 +02:00
|
|
|
*
|
2012-07-18 01:12:10 +02:00
|
|
|
* @param string $html
|
|
|
|
* @param string/int $id
|
|
|
|
* @return string
|
2012-07-16 22:39:01 +02:00
|
|
|
*/
|
2012-07-18 01:12:10 +02:00
|
|
|
function parseFieldHTMLWithRecordID($html, $id)
|
|
|
|
{
|
|
|
|
$prefix = 'record_'.$id.'_';
|
|
|
|
return str_ireplace ( array('id="', 'for="', 'name="'),
|
|
|
|
array('id="'.$prefix, 'for="'.$prefix, 'name="'.$prefix),
|
|
|
|
$html);
|
2012-07-16 22:39:01 +02:00
|
|
|
}
|
2012-07-18 01:12:10 +02:00
|
|
|
|
2012-07-16 22:39:01 +02:00
|
|
|
/**
|
2012-07-18 14:23:51 +02:00
|
|
|
* Edited version of the GridFieldEditForm function
|
|
|
|
* adds the 'Bulk Upload' at the end of the crums
|
|
|
|
*
|
2012-07-16 22:39:01 +02:00
|
|
|
* CMS-specific functionality: Passes through navigation breadcrumbs
|
|
|
|
* to the template, and includes the currently edited record (if any).
|
|
|
|
* see {@link LeftAndMain->Breadcrumbs()} for details.
|
|
|
|
*
|
2012-07-18 14:23:51 +02:00
|
|
|
* @author SilverStripe original Breadcrumbs() method
|
|
|
|
* @see GridFieldDetailForm_ItemRequest
|
2012-07-16 22:39:01 +02:00
|
|
|
* @param boolean $unlinked
|
|
|
|
* @return ArrayData
|
|
|
|
*/
|
|
|
|
function Breadcrumbs($unlinked = false) {
|
|
|
|
if(!$this->controller->hasMethod('Breadcrumbs')) return;
|
|
|
|
|
|
|
|
$items = $this->controller->Breadcrumbs($unlinked);
|
|
|
|
$items->push(new ArrayData(array(
|
|
|
|
'Title' => 'Bulk Upload',
|
|
|
|
'Link' => false
|
|
|
|
)));
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
}
|