本文整理汇总了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();
}
}
示例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());
}