当前位置: 首页>>代码示例>>PHP>>正文


PHP SS_List::add方法代码示例

本文整理汇总了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;
 }
开发者ID:helpfulrobot,项目名称:unclecheese-mock-dataobjects,代码行数:21,代码来源:MockDataGenerator.php

示例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;
 }
开发者ID:helpfulrobot,项目名称:jonshutt-find-many-many-dropdown,代码行数:15,代码来源:FindManyManyDropdown.php

示例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;
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:20,代码来源:GridFieldAddExistingAutocompleter.php

示例7: add

 public function add($item)
 {
     $this->list->add($item);
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:4,代码来源:ListDecorator.php


注:本文中的SS_List::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。