attachFileToBlockForm example


  protected function replaceFileInBlock(FileInterface $file) {
    $assert_session = $this->assertSession();
    $page = $this->getSession()->getPage();
    $this->clickContextualLink(static::INLINE_BLOCK_LOCATOR, 'Configure');
    $assert_session->waitForElement('css', "#drupal-off-canvas input[value='Remove']");
    $assert_session->assertWaitOnAjaxRequest();
    $page->find('css', '#drupal-off-canvas')->pressButton('Remove');
    $this->attachFileToBlockForm($file);
    $page->pressButton('Update');
    $this->assertDialogClosedAndTextVisible($file->label()static::INLINE_BLOCK_LOCATOR);
  }

  /** * Adds an entity block with a file. * * @param string $title * The title field value. * @param \Drupal\file\Entity\File $file * The file entity. */
Home | Imprint | This part of the site doesn't use cookies.