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


PHP GridField::gridFieldAlterAction方法代码示例

本文整理汇总了PHP中GridField::gridFieldAlterAction方法的典型用法代码示例。如果您正苦于以下问题:PHP GridField::gridFieldAlterAction方法的具体用法?PHP GridField::gridFieldAlterAction怎么用?PHP GridField::gridFieldAlterAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GridField的用法示例。


在下文中一共展示了GridField::gridFieldAlterAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDeleteActionRemoveRelation

 public function testDeleteActionRemoveRelation()
 {
     $this->logInWithPermission('ADMIN');
     $config = GridFieldConfig::create()->addComponent(new GridFieldDeleteAction(true));
     $gridField = new GridField('testfield', 'testfield', $this->list, $config);
     $form = new Form(new Controller(), 'mockform', new FieldList(array($this->gridField)), new FieldList());
     $stateID = 'testGridStateActionField';
     Session::set($stateID, array('grid' => '', 'actionName' => 'deleterecord', 'args' => array('RecordID' => $this->idFromFixture('GridFieldAction_Delete_Team', 'team1'))));
     $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID=' . $stateID => true));
     $this->gridField->gridFieldAlterAction(array('StateID' => $stateID), $this->form, $request);
     $this->assertEquals(2, $this->list->count(), 'User should be able to delete records with ADMIN permission.');
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:12,代码来源:GridFieldDeleteActionTest.php

示例2: testSortActionWithAdminPermission

 public function testSortActionWithAdminPermission()
 {
     $team1 = $this->objFromFixture('GridFieldAction_SortOrder_Team', 'team1');
     $team2 = $this->objFromFixture('GridFieldAction_SortOrder_Team', 'team2');
     $team3 = $this->objFromFixture('GridFieldAction_SortOrder_Team', 'team3');
     $this->logInWithPermission('ADMIN');
     $stateID = 'testGridStateActionField';
     Session::set($stateID, array('grid' => '', 'actionName' => 'saveGridRowSort', 'args' => array('GridFieldSortableRows' => array('sortableToggle' => true))));
     $request = new SS_HTTPRequest('POST', 'url', array('ItemIDs' => "{$team1->ID}, {$team3->ID}, {$team2->ID}"), array('action_gridFieldAlterAction?StateID=' . $stateID => true));
     $this->gridField->gridFieldAlterAction(array('StateID' => $stateID), $this->form, $request);
     $this->assertEquals($team2->ID, $this->list->last()->ID, 'User should be able to sort records with ADMIN permission.');
 }
开发者ID:vinstah,项目名称:body,代码行数:12,代码来源:GridFieldSortableRowsTest.php

示例3: testAppendToTopAutoSort

 public function testAppendToTopAutoSort()
 {
     if (Member::currentUser()) {
         Member::currentUser()->logOut();
     }
     $this->gridField->getConfig()->getComponentByType('GridFieldSortableRows')->setAppendToTop(true);
     $this->assertEquals(0, $this->list->last()->SortOrder, 'Auto sort should not have run');
     $stateID = 'testGridStateActionField';
     Session::set($stateID, array('grid' => '', 'actionName' => 'sortableRowsToggle', 'args' => array('GridFieldSortableRows' => array('sortableToggle' => true))));
     $request = new SS_HTTPRequest('POST', 'url', array(), array('action_gridFieldAlterAction?StateID=' . $stateID => true));
     $this->gridField->gridFieldAlterAction(array('StateID' => $stateID), $this->form, $request);
     //Insure sort ran
     $this->assertEquals(3, $this->list->last()->SortOrder, 'Auto sort should have run');
     //Check for duplicates (there shouldn't be any)
     $count = $this->list->Count();
     $indexes = count(array_unique($this->list->column('SortOrder')));
     $this->assertEquals(0, $count - $indexes, 'Duplicate indexes detected');
 }
开发者ID:vinstah,项目名称:body,代码行数:18,代码来源:GridFieldSortableRowsAutoSortTest.php

示例4: testGridFieldAlterAction

 /**
  * @covers GridField::gridFieldAlterAction
  */
 public function testGridFieldAlterAction()
 {
     $config = GridFieldConfig::create()->addComponent(new GridFieldTest_Component());
     $obj = new GridField('testfield', 'testfield', ArrayList::create(), $config);
     $id = 'testGridStateActionField';
     Session::set($id, array('grid' => '', 'actionName' => 'jump'));
     $form = new Form(new Controller(), 'mockform', new FieldList(array($obj)), new FieldList());
     $request = new SS_HTTPRequest('POST', 'url');
     $obj->gridFieldAlterAction(array('StateID' => $id), $form, $request);
 }
开发者ID:normann,项目名称:sapphire,代码行数:13,代码来源:GridFieldTest.php


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