本文整理匯總了PHP中Drupal\field\Entity\FieldConfig::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldConfig::toArray方法的具體用法?PHP FieldConfig::toArray怎麽用?PHP FieldConfig::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\field\Entity\FieldConfig
的用法示例。
在下文中一共展示了FieldConfig::toArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testToArray
/**
* @covers ::toArray()
*/
public function testToArray()
{
$field = new FieldConfig(array('field_name' => $this->fieldStorage->getName(), 'entity_type' => 'test_entity_type', 'bundle' => 'test_bundle', 'field_type' => 'test_field'), $this->entityTypeId);
$expected = array('id' => 'test_entity_type.test_bundle.field_test', 'uuid' => NULL, 'status' => TRUE, 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'field_name' => 'field_test', 'entity_type' => 'test_entity_type', 'bundle' => 'test_bundle', 'label' => '', 'description' => '', 'required' => FALSE, 'default_value' => array(), 'default_value_callback' => '', 'settings' => array(), 'dependencies' => array(), 'field_type' => 'test_field');
$this->entityManager->expects($this->any())->method('getDefinition')->with($this->entityTypeId)->will($this->returnValue($this->entityType));
$this->entityType->expects($this->once())->method('getKey')->with('id')->will($this->returnValue('id'));
$this->typedConfigManager->expects($this->once())->method('getDefinition')->will($this->returnValue(array('mapping' => array_fill_keys(array_keys($expected), ''))));
$export = $field->toArray();
$this->assertEquals($expected, $export);
}