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


PHP FieldList::First方法代码示例

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


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

示例1: defaultAction

 /**
  * Return the default button that should be clicked when another one isn't
  * available.
  *
  * @return FormAction
  */
 public function defaultAction()
 {
     if ($this->hasDefaultAction && $this->actions) {
         return $this->actions->First();
     }
 }
开发者ID:rasstislav,项目名称:silverstripe-framework,代码行数:12,代码来源:Form.php

示例2: testPushFieldToBeginningOfSet

 /**
  * Test pushing a field to the beginning of a set.
  *
  * This tests {@link FieldList->unshift()}.
  */
 public function testPushFieldToBeginningOfSet()
 {
     $fields = new FieldList();
     /* A field named Country is added to the set */
     $fields->unshift(new TextField('Country'));
     /* We only have 1 field in the set */
     $this->assertEquals(1, $fields->Count());
     /* Another field called Email is added to the set */
     $fields->unshift(new EmailField('Email'));
     /* There are now 2 fields in the set */
     $this->assertEquals(2, $fields->Count());
     /* The most recently added field is at the beginning of the set */
     $this->assertEquals('Email', $fields->First()->getName());
     // Test that pushing a composite field without a name onto the set works
     $fields->unshift(new CompositeField(new TextField('Test1'), new TextField('Test2')));
     $this->assertEquals(3, $fields->Count());
 }
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:22,代码来源:FieldListTest.php


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