本文整理汇总了PHP中DataList::add方法的典型用法代码示例。如果您正苦于以下问题:PHP DataList::add方法的具体用法?PHP DataList::add怎么用?PHP DataList::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataList
的用法示例。
在下文中一共展示了DataList::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAll
/**
* Add records to the list.
*/
protected function processAll($filepath, $preview = false)
{
$iterator = $this->getSource()->getIterator();
$results = new BetterBulkLoader_Result();
foreach ($iterator as $record) {
if ($id = $this->processRecord($record, $this->columnMap, $results, $preview)) {
$this->list->add($id);
}
}
return $results;
}
示例2: handleAction
/**
* Handles the given action context.
*
* @param GridField $gridField GridField to handle action for
* @param string $actionName Name of the action to handle
* @param array $arguments Arguments
* @param array $data Post data to handle
*
* @return string
*
* @author Sebastian Diel <sdiel@pixeltricks.de>
* @since 14.03.2013
*/
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
{
if ($actionName == 'addsubobject') {
$recordID = $data['SubObjectParentID'];
$subObjectID = $data[$gridField->getModelClass() . 'SubObjects'][$recordID];
$list = $gridField->getList();
$parent = DataObject::get($gridField->getModelClass())->byID($recordID);
$subObject = DataObject::get($this->targetClassName)->byID($subObjectID);
if ($subObject instanceof $this->targetClassName && $subObject->exists()) {
$this->subList->add($subObject);
}
} elseif ($actionName == 'removesubobject' || $actionName == 'activatesubobject' || $actionName == 'deactivatesubobject' || $actionName == 'defaultsubobject' || $actionName == 'undefaultsubobject') {
$recordID = $data['SubObjectParentID'];
$subObjectID = $data['SubObjectID'];
$list = $gridField->getList();
$parent = DataObject::get($gridField->getModelClass())->byID($recordID);
$subObject = DataObject::get($this->targetClassName)->byID($subObjectID);
if ($subObject instanceof $this->targetClassName && $subObject->exists()) {
if ($actionName == 'defaultsubobject' || $actionName == 'undefaultsubobject') {
$this->subList->add($subObject, array('IsDefault' => $actionName == 'defaultsubobject'));
} elseif ($actionName == 'activatesubobject' || $actionName == 'deactivatesubobject') {
$this->subList->add($subObject, array('IsActive' => $actionName == 'activatesubobject'));
} elseif ($actionName == 'removesubobject') {
$this->subList->remove($subObject);
}
}
}
}