protected function ImageFieldCreationTrait::createImageField in Insert 8
Parameters
string $name:
string $type_name:
array [$storage_settings=array()]:
array [$field_settings=array()]:
array [$widget_settings=array()]:
array [$formatter_settings=array()]:
string [$description='']:
Return value
\Drupal\Core\Entity\EntityInterface|static
See also
\Drupal\Tests\image\Kernel\ImageFieldCreationTrait::createImageField
8 calls to ImageFieldCreationTrait::createImageField()
- InsertImageWidgetTest::testAbsoluteUrlSetting in tests/
src/ FunctionalJavaScript/ InsertImageWidgetTest.php - InsertImageWidgetTest::testDefaultWidgetElement in tests/
src/ FunctionalJavaScript/ InsertImageWidgetTest.php - InsertImageWidgetTest::testImageUrlOutput in tests/
src/ FunctionalJavaScript/ InsertImageWidgetTest.php - InsertImageWidgetTest::testOriginalImageRotation in tests/
src/ FunctionalJavaScript/ InsertImageWidgetTest.php - InsertImageWidgetTest::testRotationWithAbsoluteUrl in tests/
src/ FunctionalJavaScript/ InsertImageWidgetTest.php
File
- tests/
src/ FunctionalJavaScript/ ImageFieldCreationTrait.php, line 29
Class
- ImageFieldCreationTrait
- Provides a helper method for creating Image fields having assigned the Insert widget.
Namespace
Drupal\Tests\insert\FunctionalJavascriptCode
protected function createImageField($name, $type_name, $storage_settings = [], $field_settings = [], $widget_settings = [], $formatter_settings = [], $description = '') {
$field_config = $this
->imageCreateImageField($name, $type_name, $storage_settings, $field_settings, $widget_settings, $formatter_settings, $description);
/** @var EntityDisplayInterface $entity */
$entity = \Drupal::entityTypeManager()
->getStorage('entity_form_display')
->load('node.' . $type_name . '.default');
$entity
->setComponent($name, [
'type' => 'insert_image',
'settings' => $widget_settings,
])
->save();
return $field_config;
}