コード例 #1
0
 /**
  * Get a list of all actions, including those in the main "fields" FieldList
  *
  * @return array
  */
 protected function getAllActions()
 {
     $fields = $this->fields->dataFields() ?: array();
     $actions = $this->actions->dataFields() ?: array();
     $fieldsAndActions = array_merge($fields, $actions);
     $actions = array_filter($fieldsAndActions, function ($fieldOrAction) {
         return $fieldOrAction instanceof FormAction;
     });
     return $actions;
 }
コード例 #2
0
 public function testInsertBeforeMultipleFields()
 {
     $fields = new FieldList($root = new TabSet("Root", $main = new Tab("Main", $a = new TextField("A"), $b = new TextField("B"))));
     $fields->addFieldsToTab('Root.Main', array(new TextField('NewField1'), new TextField('NewField2')), 'B');
     $this->assertEquals(array_keys($fields->dataFields()), array('A', 'NewField1', 'NewField2', 'B'));
 }