本文整理汇总了PHP中GridField::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP GridField::setValue方法的具体用法?PHP GridField::setValue怎么用?PHP GridField::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GridField
的用法示例。
在下文中一共展示了GridField::setValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAllRecords
protected function saveAllRecords(\GridField $grid, $arguments, $data)
{
if (isset($data[$grid->Name])) {
$currValue = $grid->Value();
$grid->setValue($data[$grid->Name]);
$model = singleton($grid->List->dataClass());
foreach ($grid->getConfig()->getComponents() as $component) {
if ($component instanceof \GridField_SaveHandler) {
$component->handleSave($grid, $model);
}
}
if ($this->publish) {
// Only use the viewable list items, since bulk publishing can take a toll on the system
$list = ($paginator = $grid->getConfig()->getComponentByType('GridFieldPaginator')) ? $paginator->getManipulatedData($grid, $grid->List) : $grid->List;
$list->each(function ($item) {
if ($item->hasExtension('Versioned')) {
$item->writeToStage('Stage');
$item->publish('Stage', 'Live');
}
});
}
if ($model->exists()) {
$model->delete();
$model->destroy();
}
$grid->setValue($currValue);
if (\Controller::curr() && ($response = \Controller::curr()->Response)) {
if (!$this->completeMessage) {
$this->completeMessage = _t('GridField.DONE', 'Done.');
}
$response->addHeader('X-Status', rawurlencode($this->completeMessage));
}
}
}