protected function BlazyUnitTestTrait::getDefaultFields in Blazy 8
Same name and namespace in other branches
- 8.2 tests/src/Traits/BlazyUnitTestTrait.php \Drupal\Tests\blazy\Traits\BlazyUnitTestTrait::getDefaultFields()
Returns dummy fields for an entity reference.
Return value
array A common field array for Blazy related entity reference formatter.
7 calls to BlazyUnitTestTrait::getDefaultFields()
- BlazyAdminExtendedUnitTest::testBuildSettingsForm in tests/
src/ Unit/ Form/ BlazyAdminExtendedUnitTest.php - Tests BlazyAdminExtended.
- BlazyAdminFormatterUnitTest::testBuildSettingsForm in tests/
src/ Unit/ Form/ BlazyAdminFormatterUnitTest.php - @covers ::buildSettingsForm @covers ::openingForm @covers ::imageStyleForm @covers ::mediaSwitchForm @covers ::gridForm @covers ::breakpointsForm @covers ::closingForm @covers ::finalizeForm
- BlazyEntityReferenceFormatterTest::testBuildPreview in tests/
src/ Kernel/ BlazyEntityReferenceFormatterTest.php - Tests Blazy preview.
- BlazyEntityReferenceFormatterTest::testFormatterDisplay in tests/
src/ Kernel/ BlazyEntityReferenceFormatterTest.php - Tests the Blazy formatter display.
- BlazyEntityReferenceFormatterTest::testFormatterSettingsForm in tests/
src/ Kernel/ BlazyEntityReferenceFormatterTest.php - Tests the Blazy formatter settings form.
File
- tests/
src/ Traits/ BlazyUnitTestTrait.php, line 257
Class
- BlazyUnitTestTrait
- A Trait common for Blazy Unit tests.
Namespace
Drupal\Tests\blazy\TraitsCode
protected function getDefaultFields($select = FALSE) {
$fields = [
'field_class' => 'text',
'field_id' => 'text',
'field_image' => 'image',
'field_layout' => 'list_string',
'field_link' => 'link',
'field_title' => 'text',
'field_teaser' => 'text',
];
$options = [];
foreach (array_keys($fields) as $key) {
if (in_array($key, [
'field_id',
'field_teaser',
])) {
continue;
}
$option = str_replace('field_', '', $key);
$options[$option] = $key;
}
return $select ? $options : $fields;
}