importContentFromFile example

/** * Imports default contents. * * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException * @throws \Drupal\Core\Entity\EntityStorageException */
  public function importContent() {
    $this->getModulePath()
      ->importEditors()
      ->importContentFromFile('taxonomy_term', 'tags')
      ->importContentFromFile('taxonomy_term', 'recipe_category')
      ->importContentFromFile('media', 'image')
      ->importContentFromFile('node', 'recipe')
      ->importContentFromFile('node', 'article')
      ->importContentFromFile('node', 'page')
      ->importContentFromFile('block_content', 'disclaimer_block')
      ->importContentFromFile('block_content', 'footer_promo_block')
      ->importContentFromFile('block_content', 'banner_block');
  }

  /** * Set module_path variable. * * @return $this */
Home | Imprint | This part of the site doesn't use cookies.