• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Entity\EntityFormDisplay类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Drupal\Core\Entity\Entity\EntityFormDisplay的典型用法代码示例。如果您正苦于以下问题:PHP EntityFormDisplay类的具体用法?PHP EntityFormDisplay怎么用?PHP EntityFormDisplay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了EntityFormDisplay类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: assertComponent

 /**
  * Asserts various aspects of a particular component of a form display.
  *
  * @param string $display_id
  *   The form display ID.
  * @param string $component_id
  *   The component ID.
  * @param string $widget_type
  *   The expected widget type.
  * @param string $weight
  *   The expected weight of the component.
  */
 protected function assertComponent($display_id, $component_id, $widget_type, $weight)
 {
     $component = EntityFormDisplay::load($display_id)->getComponent($component_id);
     $this->assertTrue(is_array($component));
     $this->assertIdentical($widget_type, $component['type']);
     $this->assertIdentical($weight, $component['weight']);
 }
开发者ID:komejo,项目名称:article-test,代码行数:19,代码来源:MigrateFieldInstanceWidgetSettingsTest.php


示例2: assertDisplay

 /**
  * Asserts a display entity.
  *
  * @param string $id
  *   The entity ID.
  * @param string $component
  *   The ID of the form component.
  */
 protected function assertDisplay($id, $component_id)
 {
     $component = EntityFormDisplay::load($id)->getComponent($component_id);
     $this->assertTrue(is_array($component));
     $this->assertIdentical('comment_default', $component['type']);
     $this->assertIdentical(20, $component['weight']);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:MigrateCommentEntityFormDisplayTest.php


示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->drupalPlaceBlock('local_tasks_block');
     $this->drupalPlaceBlock('local_actions_block');
     $this->drupalPlaceBlock('page_title_block');
     $this->type = $this->createProfileType('test', 'Test profile', TRUE);
     $id = $this->type->id();
     $field_storage = FieldStorageConfig::create(['field_name' => 'profile_fullname', 'entity_type' => 'profile', 'type' => 'text']);
     $field_storage->save();
     $this->field = FieldConfig::create(['field_storage' => $field_storage, 'bundle' => $this->type->id(), 'label' => 'Full name']);
     $this->field->save();
     // Configure the default display.
     $this->display = EntityViewDisplay::load("profile.{$this->type->id()}.default");
     if (!$this->display) {
         $this->display = EntityViewDisplay::create(['targetEntityType' => 'profile', 'bundle' => $this->type->id(), 'mode' => 'default', 'status' => TRUE]);
         $this->display->save();
     }
     $this->display->setComponent($this->field->getName(), ['type' => 'string'])->save();
     // Configure rhe default form.
     $this->form = EntityFormDisplay::load("profile.{$this->type->id()}.default");
     if (!$this->form) {
         $this->form = EntityFormDisplay::create(['targetEntityType' => 'profile', 'bundle' => $this->type->id(), 'mode' => 'default', 'status' => TRUE]);
         $this->form->save();
     }
     $this->form->setComponent($this->field->getName(), ['type' => 'string_textfield'])->save();
     $this->checkPermissions(['administer profile types', "view own {$id} profile", "view any {$id} profile", "add own {$id} profile", "add any {$id} profile", "edit own {$id} profile", "edit any {$id} profile", "delete own {$id} profile", "delete any {$id} profile"]);
     user_role_grant_permissions(AccountInterface::AUTHENTICATED_ROLE, ['access user profiles']);
     $this->adminUser = $this->drupalCreateUser(['administer profile types', "view any {$id} profile", "add any {$id} profile", "edit any {$id} profile", "delete any {$id} profile"]);
 }
开发者ID:darrylri,项目名称:protovbmwmo,代码行数:33,代码来源:ProfileTestBase.php


示例4: testEntityFormDisplaySettings

 /**
  * Tests the field's entity form display settings.
  */
 public function testEntityFormDisplaySettings()
 {
     $component = EntityFormDisplay::load('user.user.default')->getComponent('user_picture');
     $this->assertIdentical('image_image', $component['type']);
     $this->assertIdentical('throbber', $component['settings']['progress_indicator']);
     $this->assertIdentical('thumbnail', $component['settings']['preview_image_style']);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:MigrateUserPictureEntityFormDisplayTest.php


示例5: testDeleteGroup

 /**
  * Delete a group.
  */
 function testDeleteGroup()
 {
     $data = array('format_type' => 'fieldset', 'label' => 'testing');
     $group = $this->createGroup('node', $this->type, 'form', 'default', $data);
     $config_name = 'node.' . $this->type . '.form.default.' . $group->group_name;
     $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/groups/' . $config_name . '/delete', array(), t('Delete'));
     $this->assertRaw(t('The group %label has been deleted from the %type content type.', array('%label' => $group->label, '%type' => $this->type)), t('Group removal message displayed on screen.'));
     $display = EntityFormDisplay::load($group->entity_type . '.' . $group->bundle . '.' . $group->mode);
     $data = $display->getThirdPartySettings('field_group');
     debug($data);
     // Test that group is not in the $groups array.
     \Drupal::entityManager()->getStorage('entity_form_display')->resetCache();
     $loaded_group = field_group_load_field_group($group->group_name, 'node', $this->type, 'form', 'default');
     debug($loaded_group);
     $this->assertNull($loaded_group, t('Group not found after deleting'));
     $data = array('format_type' => 'fieldset', 'label' => 'testing');
     $group = $this->createGroup('node', $this->type, 'view', 'default', $data);
     $config_name = 'node.' . $this->type . '.view.default.' . $group->group_name;
     $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/groups/' . $config_name . '/delete', array(), t('Delete'));
     $this->assertRaw(t('The group %label has been deleted from the %type content type.', array('%label' => $group->label, '%type' => $this->type)), t('Group removal message displayed on screen.'));
     // Test that group is not in the $groups array.
     \Drupal::entityManager()->getStorage('entity_view_display')->resetCache();
     $loaded_group = field_group_load_field_group($group->group_name, 'node', $this->type, 'view', 'default');
     debug($loaded_group);
     $this->assertNull($loaded_group, t('Group not found after deleting'));
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:29,代码来源:ManageDisplayTest.php


示例6: assertDisplay

 /**
  * Asserts a display entity.
  *
  * @param string $id
  *   The entity ID.
  */
 protected function assertDisplay($id)
 {
     $component = EntityFormDisplay::load($id)->getComponent('subject');
     $this->assertTrue(is_array($component));
     $this->assertIdentical('string_textfield', $component['type']);
     $this->assertIdentical(10, $component['weight']);
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:13,代码来源:MigrateCommentEntityFormDisplaySubjectTest.php


示例7: setUp

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->adminUser = $this->drupalCreateUser([
      'administer products',
      'administer stores',
      'access administration pages',
    ]);
    $this->drupalLogin($this->adminUser);

    $this->referenceField = FieldStorageConfig::loadByName('commerce_product', 'stores');
    $display = EntityFormDisplay::load('commerce_product.default.default');
    $display->setComponent('stores', [
      'type' => 'entity_select',
      'settings' => [
        'autocomplete_threshold' => 2,
      ],
    ])->save();

    $variation = $this->createEntity('commerce_product_variation', [
     'type' => 'default',
      'sku' => strtolower($this->randomMachineName()),
    ]);
    $this->product = $this->createEntity('commerce_product', [
      'type' => 'default',
      'title' => $this->randomMachineName(),
      'variations' => [$variation],
    ]);
  }
开发者ID:housineali,项目名称:drpl8_dv,代码行数:32,代码来源:EntitySelectWidgetTest.php


示例8: testEntityReferenceXSS

 /**
  * Tests markup is escaped in the entity reference select and label formatter.
  */
 public function testEntityReferenceXSS()
 {
     $this->drupalCreateContentType(['type' => 'article']);
     // Create a node with markup in the title.
     $node_type_one = $this->drupalCreateContentType();
     $node = ['type' => $node_type_one->id(), 'title' => '<em>I am kitten</em>'];
     $referenced_node = $this->drupalCreateNode($node);
     $node_type_two = $this->drupalCreateContentType(['name' => '<em>bundle with markup</em>']);
     $this->drupalCreateNode(['type' => $node_type_two->id(), 'title' => 'My bundle has markup']);
     $this->createEntityReferenceField('node', 'article', 'entity_reference_test', 'Entity Reference test', 'node', 'default', ['target_bundles' => [$node_type_one->id(), $node_type_two->id()]]);
     EntityFormDisplay::load('node.article.default')->setComponent('entity_reference_test', ['type' => 'options_select'])->save();
     EntityViewDisplay::load('node.article.default')->setComponent('entity_reference_test', ['type' => 'entity_reference_label'])->save();
     // Create a node and reference the node with markup in the title.
     $this->drupalLogin($this->rootUser);
     $this->drupalGet('node/add/article');
     $this->assertEscaped($referenced_node->getTitle());
     $this->assertEscaped($node_type_two->label());
     $edit = ['title[0][value]' => $this->randomString(), 'entity_reference_test' => $referenced_node->id()];
     $this->drupalPostForm(NULL, $edit, 'Save and publish');
     $this->assertEscaped($referenced_node->getTitle());
     // Test the options_buttons type.
     EntityFormDisplay::load('node.article.default')->setComponent('entity_reference_test', ['type' => 'options_buttons'])->save();
     $this->drupalGet('node/add/article');
     $this->assertEscaped($referenced_node->getTitle());
     // options_buttons does not support optgroups.
     $this->assertNoText('bundle with markup');
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:30,代码来源:EntityReferenceXSSTest.php


示例9: testCommentEntityFormDisplay

 /**
  * Tests comment subject variable migrated into an entity display.
  */
 public function testCommentEntityFormDisplay()
 {
     $component = EntityFormDisplay::load('comment.comment.default')->getComponent('subject');
     $this->assertIdentical('string_textfield', $component['type']);
     $this->assertIdentical(10, $component['weight']);
     $component = EntityFormDisplay::load('comment.comment_no_subject.default')->getComponent('subject');
     $this->assertNull($component);
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:11,代码来源:MigrateCommentVariableEntityFormDisplaySubjectTest.php


示例10: testCommentEntityFormDisplay

 /**
  * Tests comment variables migrated into an entity display.
  */
 public function testCommentEntityFormDisplay()
 {
     foreach (['page', 'article', 'story'] as $type) {
         $component = EntityFormDisplay::load('node.' . $type . '.default')->getComponent('comment');
         $this->assertIdentical('comment_default', $component['type']);
         $this->assertIdentical(20, $component['weight']);
     }
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:11,代码来源:MigrateCommentVariableEntityFormDisplayTest.php


示例11: testVocabularyEntityFormDisplay

 /**
  * Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
  */
 public function testVocabularyEntityFormDisplay()
 {
     // Test that the field exists.
     $component = EntityFormDisplay::load('node.page.default')->getComponent('tags');
     $this->assertIdentical('options_select', $component['type']);
     $this->assertIdentical(20, $component['weight']);
     // Test the Id map.
     $this->assertIdentical(array('node', 'article', 'default', 'tags'), Migration::load('d6_vocabulary_entity_form_display')->getIdMap()->lookupDestinationID(array(4, 'article')));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:MigrateVocabularyEntityFormDisplayTest.php


示例12: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->referenceField = FieldStorageConfig::loadByName('commerce_product', 'stores');
     $display = EntityFormDisplay::load('commerce_product.default.default');
     $display->setComponent('stores', ['type' => 'commerce_entity_select', 'settings' => ['autocomplete_threshold' => 2]])->save();
     $variation = $this->createEntity('commerce_product_variation', ['type' => 'default', 'sku' => strtolower($this->randomMachineName())]);
     $this->product = $this->createEntity('commerce_product', ['type' => 'default', 'title' => $this->randomMachineName(), 'variations' => [$variation]]);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:12,代码来源:EntitySelectWidgetTest.php


示例13: testEntityDisplayDependency

 /**
  * Tests the dependency between ImageStyle and entity display components.
  */
 public function testEntityDisplayDependency()
 {
     // Create two image styles.
     /** @var \Drupal\image\ImageStyleInterface $style */
     $style = ImageStyle::create(['name' => 'main_style']);
     $style->save();
     /** @var \Drupal\image\ImageStyleInterface $replacement */
     $replacement = ImageStyle::create(['name' => 'replacement_style']);
     $replacement->save();
     // Create a node-type, named 'note'.
     $node_type = NodeType::create(['type' => 'note']);
     $node_type->save();
     // Create an image field and attach it to the 'note' node-type.
     FieldStorageConfig::create(['entity_type' => 'node', 'field_name' => 'sticker', 'type' => 'image'])->save();
     FieldConfig::create(['entity_type' => 'node', 'field_name' => 'sticker', 'bundle' => 'note'])->save();
     // Create the default entity view display and set the 'sticker' field to use
     // the 'main_style' images style in formatter.
     /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
     $view_display = EntityViewDisplay::create(['targetEntityType' => 'node', 'bundle' => 'note', 'mode' => 'default', 'status' => TRUE])->setComponent('sticker', ['settings' => ['image_style' => 'main_style']]);
     $view_display->save();
     // Create the default entity form display and set the 'sticker' field to use
     // the 'main_style' images style in the widget.
     /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
     $form_display = EntityFormDisplay::create(['targetEntityType' => 'node', 'bundle' => 'note', 'mode' => 'default', 'status' => TRUE])->setComponent('sticker', ['settings' => ['preview_image_style' => 'main_style']]);
     $form_display->save();
     // Check that the entity displays exists before dependency removal.
     $this->assertNotNull(EntityViewDisplay::load($view_display->id()));
     $this->assertNotNull(EntityFormDisplay::load($form_display->id()));
     // Delete the 'main_style' image style. Before that, emulate the UI process
     // of selecting a replacement style by setting the replacement image style
     // ID in the image style storage.
     /** @var \Drupal\image\ImageStyleStorageInterface $storage */
     $storage = $this->container->get('entity.manager')->getStorage($style->getEntityTypeId());
     $storage->setReplacementId('main_style', 'replacement_style');
     $style->delete();
     // Check that the entity displays exists after dependency removal.
     $this->assertNotNull($view_display = EntityViewDisplay::load($view_display->id()));
     $this->assertNotNull($form_display = EntityFormDisplay::load($form_display->id()));
     // Check that the 'sticker' formatter component exists in both displays.
     $this->assertNotNull($formatter = $view_display->getComponent('sticker'));
     $this->assertNotNull($widget = $form_display->getComponent('sticker'));
     // Check that both displays are using now 'replacement_style' for images.
     $this->assertSame('replacement_style', $formatter['settings']['image_style']);
     $this->assertSame('replacement_style', $widget['settings']['preview_image_style']);
     // Delete the 'replacement_style' without setting a replacement image style.
     $replacement->delete();
     // The entity view and form displays exists after dependency removal.
     $this->assertNotNull($view_display = EntityViewDisplay::load($view_display->id()));
     $this->assertNotNull($form_display = EntityFormDisplay::load($form_display->id()));
     // The 'sticker' formatter component should be hidden in view display.
     $this->assertNull($view_display->getComponent('sticker'));
     $this->assertTrue($view_display->get('hidden')['sticker']);
     // The 'sticker' widget component should be active in form displays, but the
     // image preview should be disabled.
     $this->assertNotNull($widget = $form_display->getComponent('sticker'));
     $this->assertSame('', $widget['settings']['preview_image_style']);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:60,代码来源:ImageStyleIntegrationTest.php


示例14: init

 /**
  * Initialize the form state and the entity before the first form build.
  */
 protected function init(FormStateInterface $form_state)
 {
     // Ensure we act on the translation object corresponding to the current form
     // language.
     $langcode = $this->getFormLangcode($form_state);
     $this->entity = $this->entity->getTranslation($langcode);
     $form_display = EntityFormDisplay::collectRenderDisplay($this->entity, $this->getOperation());
     $this->setFormDisplay($form_display, $form_state);
     parent::init($form_state);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:ContentEntityForm.php


示例15: image_post_update_image_style_dependencies

/**
 * Saves the image style dependencies into form and view display entities.
 */
function image_post_update_image_style_dependencies()
{
    // Merge view and form displays. Use array_values() to avoid key collisions.
    $displays = array_merge(array_values(EntityViewDisplay::loadMultiple()), array_values(EntityFormDisplay::loadMultiple()));
    /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface[] $displays */
    foreach ($displays as $display) {
        // Re-save each config entity to add missed dependencies.
        $display->save();
    }
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:image.post_update.php


示例16: createField

 /**
  * Creates a date test field.
  */
 protected function createField()
 {
     $field_name = Unicode::strtolower($this->randomMachineName());
     $type = $this->getTestFieldType();
     $widget_type = $formatter_type = $type . '_default';
     $this->fieldStorage = FieldStorageConfig::create(['field_name' => $field_name, 'entity_type' => 'entity_test', 'type' => $type, 'settings' => ['datetime_type' => DateRangeItem::DATETIME_TYPE_DATE]]);
     $this->fieldStorage->save();
     $this->field = FieldConfig::create(['field_storage' => $this->fieldStorage, 'bundle' => 'entity_test', 'required' => TRUE]);
     $this->field->save();
     EntityFormDisplay::load('entity_test.entity_test.default')->setComponent($field_name, ['type' => $widget_type])->save();
     $this->displayOptions = ['type' => $formatter_type, 'label' => 'hidden', 'settings' => ['format_type' => 'medium'] + $this->defaultSettings];
     EntityViewDisplay::create(['targetEntityType' => $this->field->getTargetEntityTypeId(), 'bundle' => $this->field->getTargetBundle(), 'mode' => 'full', 'status' => TRUE])->setComponent($field_name, $this->displayOptions)->save();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:16,代码来源:DateTestBase.php


示例17: testVocabularyEntityFormDisplay

 /**
  * Tests the Drupal 6 vocabulary-node type association to Drupal 8 migration.
  */
 public function testVocabularyEntityFormDisplay()
 {
     // Test that the field exists.
     $component = EntityFormDisplay::load('node.page.default')->getComponent('tags');
     $this->assertIdentical('options_select', $component['type']);
     $this->assertIdentical(20, $component['weight']);
     // Test the Id map.
     $this->assertIdentical(array('node', 'article', 'default', 'tags'), $this->getMigration('d6_vocabulary_entity_form_display')->getIdMap()->lookupDestinationID(array(4, 'article')));
     // Test the term widget tags setting.
     $entity_form_display = EntityFormDisplay::load('node.story.default');
     $this->assertIdentical($entity_form_display->getComponent('vocabulary_1_i_0_')['type'], 'options_select');
     $this->assertIdentical($entity_form_display->getComponent('vocabulary_2_i_1_')['type'], 'entity_reference_autocomplete_tags');
 }
开发者ID:sojo,项目名称:d8_friendsofsilence,代码行数:16,代码来源:MigrateVocabularyEntityFormDisplayTest.php


示例18: testUploadEntityFormDisplay

 /**
  * Tests the Drupal 6 upload settings to Drupal 8 entity form display migration.
  */
 public function testUploadEntityFormDisplay()
 {
     $display = EntityFormDisplay::load('node.page.default');
     $component = $display->getComponent('upload');
     $this->assertIdentical('file_generic', $component['type']);
     $display = EntityFormDisplay::load('node.story.default');
     $component = $display->getComponent('upload');
     $this->assertIdentical('file_generic', $component['type']);
     // Assure this doesn't exist.
     $display = EntityFormDisplay::load('node.article.default');
     $component = $display->getComponent('upload');
     $this->assertTrue(is_null($component));
     $this->assertIdentical(array('node', 'page', 'default', 'upload'), Migration::load('d6_upload_entity_form_display')->getIdMap()->lookupDestinationID(array('page')));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:17,代码来源:MigrateUploadEntityFormDisplayTest.php


示例19: buildForm

 /**
  * {@inheritdoc]
  */
 public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_1 = NULL, EntityInterface $entity_2 = NULL)
 {
     // First entity.
     $form_state->set('entity_1', $entity_1);
     $form_display_1 = EntityFormDisplay::collectRenderDisplay($entity_1, 'default');
     $form_state->set('form_display_1', $form_display_1);
     $form_display_1->buildForm($entity_1, $form, $form_state);
     // Second entity.
     $form_state->set('entity_2', $entity_2);
     $form_display_2 = EntityFormDisplay::collectRenderDisplay($entity_2, 'default');
     $form_state->set('form_display_2', $form_display_2);
     $form['entity_2'] = array('#type' => 'details', '#title' => t('Second entity'), '#tree' => TRUE, '#parents' => array('entity_2'), '#weight' => 50);
     $form_display_2->buildForm($entity_2, $form['entity_2'], $form_state);
     $form['save'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 100);
     return $form;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:19,代码来源:NestedEntityTestForm.php


示例20: testDelete

 /**
  * Tests image style deletion.
  */
 public function testDelete()
 {
     $this->drupalGet('admin/config/media/image-styles/manage/medium/delete');
     // Checks that the 'replacement' select element is displayed.
     $this->assertFieldByName('replacement');
     // Checks that UI messages are correct.
     $this->assertRaw(t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted. If no replacement style is selected, the dependent configurations might need manual reconfiguration.'));
     $this->assertNoRaw(t('All images that have been generated for this style will be permanently deleted. The dependent configurations might need manual reconfiguration.'));
     // Delete 'medium' image style but replace it with 'thumbnail'. This style
     // is involved in 'node.page.default' display view and form.
     $this->drupalPostForm(NULL, ['replacement' => 'thumbnail'], t('Delete'));
     /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
     $view_display = EntityViewDisplay::load('node.page.default');
     // Checks that the formatter setting is replaced.
     if ($this->assertNotNull($component = $view_display->getComponent('foo'))) {
         $this->assertIdentical($component['settings']['image_style'], 'thumbnail');
     }
     /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
     $form_display = EntityFormDisplay::load('node.page.default');
     // Check that the widget setting is replaced.
     if ($this->assertNotNull($component = $form_display->getComponent('foo'))) {
         $this->assertIdentical($component['settings']['preview_image_style'], 'thumbnail');
     }
     $this->drupalGet('admin/config/media/image-styles/manage/thumbnail/delete');
     // Checks that the 'replacement' select element is displayed.
     $this->assertFieldByName('replacement');
     // Checks that UI messages are correct.
     $this->assertRaw(t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted. If no replacement style is selected, the dependent configurations might need manual reconfiguration.'));
     $this->assertNoRaw(t('All images that have been generated for this style will be permanently deleted. The dependent configurations might need manual reconfiguration.'));
     // Delete 'thumbnail' image style. Provide no replacement.
     $this->drupalPostForm(NULL, [], t('Delete'));
     $view_display = EntityViewDisplay::load('node.page.default');
     // Checks that the formatter setting is disabled.
     $this->assertNull($view_display->getComponent('foo'));
     $this->assertNotNull($view_display->get('hidden')['foo']);
     // Checks that widget setting is preserved with the image preview disabled.
     $form_display = EntityFormDisplay::load('node.page.default');
     $this->assertNotNull($widget = $form_display->getComponent('foo'));
     $this->assertIdentical($widget['settings']['preview_image_style'], '');
     // Now, there's only one image style configured on the system: 'large'.
     $this->drupalGet('admin/config/media/image-styles/manage/large/delete');
     // Checks that the 'replacement' select element is not displayed.
     $this->assertNoFieldByName('replacement');
     // Checks that UI messages are correct.
     $this->assertNoRaw(t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted. If no replacement style is selected, the dependent configurations might need manual reconfiguration.'));
     $this->assertRaw(t('All images that have been generated for this style will be permanently deleted. The dependent configurations might need manual reconfiguration.'));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:50,代码来源:ImageStyleDeleteTest.php



注:本文中的Drupal\Core\Entity\Entity\EntityFormDisplay类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Entity\EntityViewDisplay类代码示例发布时间:2022-05-23
下一篇:
PHP Entity\EntityTypeManagerInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap