本文整理汇总了PHP中GridField::Link方法的典型用法代码示例。如果您正苦于以下问题:PHP GridField::Link方法的具体用法?PHP GridField::Link怎么用?PHP GridField::Link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridField
的用法示例。
在下文中一共展示了GridField::Link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
VersionedGridFieldExtensions::include_requirements();
$field->addExtraClass('ss-versioned-gridfield-orderable');
$field->setAttribute('data-url-reorder', $field->Link('reorder'));
$field->setAttribute('data-url-movetopage', $field->Link('movetopage'));
}
开发者ID:phil-quinn,项目名称:silverstripe-versioneddataobjects,代码行数:10,代码来源:VersionedGridFieldOrderableRows.php
示例2: getColumnContent
/**
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
*
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
// No permission checks, handled through GridFieldDetailForm,
// which can make the form readonly if no edit permissions are available.
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')));
return $data->renderWith('GridFieldEditButton');
}
示例3: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'refresh')));
$templatePath = dirname(dirname(__FILE__)) . '/templates/GridFieldRefreshButton.ss';
$templatePath = str_replace(BASE_PATH, '', $templatePath);
return $data->renderWith('../' . $templatePath);
}
示例4: Link
/**
* Return a Link to this field, if the list is an instance of StatefulGridFieldList the session key for the state is appended to the url
* @param {string} $action Action to append to the url
* @return {string} Relative link to this form field
*/
public function Link($action = null)
{
if ($this->list instanceof StatefulGridFieldList) {
return Controller::join_links(parent::Link($action), '?' . strtolower($this->name) . '_skey=' . $this->state->getSessionKey());
}
return parent::Link($action);
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-statefulunsavedlist,代码行数:12,代码来源:StatefulGridField.php
示例5: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record->canEdit()) {
return;
}
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')));
return $data->renderWith('GridFieldEditButton');
}
示例6: getColumnContent
/**
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
*
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record instanceof Member || !$record->canMasquerade()) {
return;
}
// No permission checks, handled through GridFieldDetailForm,
// which can make the form readonly if no edit permissions are available.
$data = new ArrayData(array('Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'masquerade')));
return $data->renderWith('GridFieldMasqueradeButton');
}
示例7: getHTMLFragments
/**
* @param GridField $field
*/
public function getHTMLFragments($field)
{
self::include_requirements();
// set ajax urls / vars
$field->addExtraClass('ss-gridfield-blockenhancements');
// $field->setAttribute('data-url-area-assignment', $field->Link('area_assignment'));
$field->setAttribute('data-url-blocktype-assignment', $field->Link('blocktype_assignment'));
// $field->setAttribute('data-block-area-none-title', Config::inst()->get(get_class(), 'unassigned_area_description'));
// add no-chozen to dropdown
// $field->getConfig()->getComponentByType('GridFieldAddNewMultiClass')->
// $field->getConfig()->getComponentByType('GridFieldDetailForm')->setAttribute('data-project-dir', project());
}
示例8: getColumnContent
/**
*
* @param \GridField $gridField
* @param \DataObject $record
* @param string $columnName
* @return string|null - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record instanceof \Payment) {
return null;
}
\Requirements::css('omnipay-ui/css/omnipay-ui-cms.css');
\Requirements::javascript('omnipay-ui/javascript/omnipay-ui-cms.js');
if (preg_match('/Pending(Capture|Void|Refund)/', $record->Status)) {
return \SSViewer::execute_template('PaymentPendingIndicator', \ArrayData::create(array('StatusLink' => \Controller::join_links($gridField->Link('checkPaymentPending')), 'PaymentID' => $record->ID, 'Timeout' => 2000)));
}
return null;
}
示例9: cacheKey
/**
* Generate a cache key unique to this gridfield
*/
protected function cacheKey()
{
return md5($this->gridField->Link());
}
示例10: Link
public function Link($action = null)
{
return Controller::join_links($this->grid->Link(), 'add-existing-search', $action);
}
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-gridfieldextensions,代码行数:4,代码来源:GridFieldAddExistingSearchHandler.php
示例11: getAttributes
/**
* @return array
*/
public function getAttributes()
{
// Store state in session, and pass ID to client side.
$state = array('grid' => $this->getNameFromParent(), 'actionName' => $this->actionName, 'args' => $this->args);
// Ensure $id doesn't contain only numeric characters
$id = 'gf_' . substr(md5(serialize($state)), 0, 8);
Session::set($id, $state);
$actionData['StateID'] = $id;
return array_merge(parent::getAttributes(), array('name' => 'action_gridFieldAlterAction' . '?' . http_build_query($actionData), 'data-url' => $this->gridField->Link()));
}
示例12: Link
public function Link($action = null)
{
return Controller::join_links($this->gridField->Link('item'), $this->record->ID ? $this->record->ID : 'new', $action);
}
示例13: getHTMLFragments
/**
* HTML to be embedded into the GridField.
*
* @param GridField $gridField
*
* @return array
*/
public function getHTMLFragments($gridField)
{
// permission check
if (!singleton($gridField->getModelClass())->canEdit()) {
return array();
}
// check BulkManager exists
$bulkManager = $gridField->getConfig()->getComponentsByType('GridFieldBulkManager');
// upload management buttons
$finishButton = FormAction::create('Finish', _t('GRIDFIELD_BULK_UPLOAD.FINISH_BTN_LABEL', 'Finish'))->addExtraClass('bulkUploadFinishButton')->setAttribute('data-icon', 'accept')->setUseButtonTag(true);
$clearErrorButton = FormAction::create('ClearError', _t('GRIDFIELD_BULK_UPLOAD.CLEAR_ERROR_BTN_LABEL', 'Clear errors'))->addExtraClass('bulkUploadClearErrorButton')->setAttribute('data-icon', 'arrow-circle-double')->setUseButtonTag(true);
if (count($bulkManager)) {
$cancelButton = FormAction::create('Cancel', _t('GRIDFIELD_BULK_UPLOAD.CANCEL_BTN_LABEL', 'Cancel'))->addExtraClass('bulkUploadCancelButton ss-ui-action-destructive')->setAttribute('data-icon', 'decline')->setAttribute('data-url', $gridField->Link('bulkupload/cancel'))->setUseButtonTag(true);
$bulkManager_config = $bulkManager->first()->getConfig();
$bulkManager_actions = $bulkManager_config['actions'];
if (array_key_exists('bulkedit', $bulkManager_actions)) {
$editAllButton = FormAction::create('EditAll', _t('GRIDFIELD_BULK_UPLOAD.EDIT_ALL_BTN_LABEL', 'Edit all'))->addExtraClass('bulkUploadEditButton')->setAttribute('data-icon', 'pencil')->setAttribute('data-url', $gridField->Link('bulkupload/edit'))->setUseButtonTag(true);
} else {
$editAllButton = '';
}
} else {
$cancelButton = '';
$editAllButton = '';
}
// get uploadField + inject extra buttons
$uploadField = $this->bulkUploadField($gridField);
$uploadField->FinishButton = $finishButton;
$uploadField->CancelButton = $cancelButton;
$uploadField->EditAllButton = $editAllButton;
$uploadField->ClearErrorButton = $clearErrorButton;
$data = ArrayData::create(array('Colspan' => count($gridField->getColumns()), 'UploadField' => $uploadField->Field()));
Requirements::css(BULKEDITTOOLS_UPLOAD_PATH . '/css/GridFieldBulkUpload.css');
Requirements::javascript(BULKEDITTOOLS_UPLOAD_PATH . '/javascript/GridFieldBulkUpload.js');
Requirements::javascript(BULKEDITTOOLS_UPLOAD_PATH . '/javascript/GridFieldBulkUpload_downloadtemplate.js');
Requirements::add_i18n_javascript(BULKEDITTOOLS_PATH . '/lang/js');
return array('header' => $data->renderWith('GridFieldBulkUpload'));
}
示例14: getAttributes
/**
* @return array
*/
public function getAttributes()
{
$state = array('grid' => $this->getNameFromParent(), 'actionName' => $this->actionName, 'args' => $this->args);
$id = 'gf_' . substr(md5(serialize($state)), 0, 8);
Session::set($id, $state);
$actionData['StateID'] = $id;
return array_merge(parent::getAttributes(), array('name' => 'action_gridFieldAlterAction?' . http_build_query($actionData), 'data-url' => $this->gridField->Link()));
}
示例15: getHTMLFragments
/**
* @param GridField $gridField
*
* @return array
*/
public function getHTMLFragments($gridField)
{
Requirements::css(BULKEDITTOOLS_MANAGER_PATH . '/css/GridFieldBulkManager.css');
Requirements::javascript(BULKEDITTOOLS_MANAGER_PATH . '/javascript/GridFieldBulkManager.js');
Requirements::add_i18n_javascript(BULKEDITTOOLS_PATH . '/lang/js');
if (!count($this->config['actions'])) {
user_error('Trying to use GridFieldBulkManager without any bulk action.', E_USER_ERROR);
}
$actionsListSource = array();
$actionsConfig = array();
foreach ($this->config['actions'] as $action => $actionData) {
$actionsListSource[$action] = $actionData['label'];
$actionsConfig[$action] = $actionData['config'];
}
reset($this->config['actions']);
$firstAction = key($this->config['actions']);
$dropDownActionsList = DropdownField::create('bulkActionName', '')->setSource($actionsListSource)->setAttribute('class', 'bulkActionName no-change-track')->setAttribute('id', '');
$templateData = array('Menu' => $dropDownActionsList->FieldHolder(), 'Button' => array('Label' => _t('GRIDFIELD_BULK_MANAGER.ACTION_BTN_LABEL', 'Go'), 'DataURL' => $gridField->Link('bulkAction'), 'Icon' => $this->config['actions'][$firstAction]['config']['icon'], 'DataConfig' => htmlspecialchars(json_encode($actionsConfig), ENT_QUOTES, 'UTF-8')), 'Select' => array('Label' => _t('GRIDFIELD_BULK_MANAGER.SELECT_ALL_LABEL', 'Select all')), 'Colspan' => count($gridField->getColumns()) - 1);
$templateData = new ArrayData($templateData);
return array('header' => $templateData->renderWith('BulkManagerButtons'));
}