當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataList::remove方法代碼示例

本文整理匯總了PHP中DataList::remove方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataList::remove方法的具體用法?PHP DataList::remove怎麽用?PHP DataList::remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataList的用法示例。


在下文中一共展示了DataList::remove方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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);
             }
         }
     }
 }
開發者ID:silvercart,項目名稱:silvercart,代碼行數:41,代碼來源:SilvercartGridFieldSubObjectHandler.php


注:本文中的DataList::remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。