本文整理匯總了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);
}
}
}
}