本文整理汇总了PHP中SS_List::add方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_List::add方法的具体用法?PHP SS_List::add怎么用?PHP SS_List::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SS_List
的用法示例。
在下文中一共展示了SS_List::add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getManipulatedData
/**
* Adds the records to the database and returns a new {@link DataList}
*
* @param GridField
* @param SS_List
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
$state = $gridField->State->MockDataGenerator;
$count = (string) $state->Count;
if (!$count) {
return $dataList;
}
$generator = new MockDataBuilder($gridField->getModelClass());
$ids = $generator->setCount($count)->setIncludeRelations($state->IncludeRelations)->setDownloadImages($state->DownloadImages === true)->generate();
foreach ($ids as $id) {
$dataList->add($id);
}
return $dataList;
}
示例2: getManipulatedData
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
$dataList->add($object);
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
示例3: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
// if the object is currently not linked to either a page or another list then we want to link to
// the original, otherwise link to a clone
if (!$object->ParentID && !$object->ListID) {
$dataList->add($object);
} else {
$virtual = new ElementVirtualLinked();
$virtual->LinkedElementID = $object->ID;
$virtual->write();
$dataList->add($virtual);
}
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:dnadesign,项目名称:silverstripe-elemental,代码行数:31,代码来源:ElementalGridFieldAddExistingAutocompleter.php
示例4: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
$virtual = new ElementVirtualLinked();
$virtual->LinkedElementID = $object->ID;
$virtual->write();
$dataList->add($virtual);
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:nyeholt,项目名称:silverstripe-elemental,代码行数:25,代码来源:ElementalGridFieldAddExistingAutocompleter.php
示例5: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
if (!$gridField->State->GridFieldAddRelation) {
return $dataList;
}
$objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
if ($objectID) {
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
if ($this->_item_limit > 0 && $dataList->count() + 1 > $this->_item_limit) {
$gridField->getForm()->getController()->getResponse()->addHeader('X-Status', _t('LimitedRelationsGridField.ITEM_LIMIT_REACHED', '_You cannot add any more items, you can only add {count} items. Please remove one then try again.', array('count' => $this->_item_limit)));
} else {
$dataList->add($object);
}
}
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-limitedrelationsgridfield,代码行数:26,代码来源:LRGridFieldAddExistingAutocompleter.php
示例6: getManipulatedData
/**
* If an object ID is set, add the object to the list
*
* @param GridField $gridField
* @param SS_List $dataList
* @return SS_List
*/
public function getManipulatedData(GridField $gridField, SS_List $dataList)
{
$objectID = $gridField->State->GridFieldAddRelation(null);
if (empty($objectID)) {
return $dataList;
}
$object = DataObject::get_by_id($dataList->dataclass(), $objectID);
if ($object) {
$dataList->add($object);
}
$gridField->State->GridFieldAddRelation = null;
return $dataList;
}
示例7: add
public function add($item)
{
$this->list->add($item);
}