You are here

interface ContentLoaderInterface in YAML Content 8

Same name and namespace in other branches
  1. 8.2 src/ContentLoader/ContentLoaderInterface.php \Drupal\yaml_content\ContentLoader\ContentLoaderInterface

Interface for loading and parsing content from YAML files.

Hierarchy

Expanded class hierarchy of ContentLoaderInterface

All classes that implement ContentLoaderInterface

9 files declare their use of ContentLoaderInterface
ContentParsedEvent.php in src/Event/ContentParsedEvent.php
DataImportEvent.php in src/Event/DataImportEvent.php
EntityImportEvent.php in src/Event/EntityImportEvent.php
EntityPostSaveEvent.php in src/Event/EntityPostSaveEvent.php
EntityPreSaveEvent.php in src/Event/EntityPreSaveEvent.php

... See full list

File

src/ContentLoader/ContentLoaderInterface.php, line 10

Namespace

Drupal\yaml_content\ContentLoader
View source
interface ContentLoaderInterface extends ContainerInjectionInterface {

  /**
   * Set a path prefix for all content files to be loaded from.
   *
   * @param string $path
   *   The path for where all content files will be loaded from.
   */
  public function setContentPath($path);

  /**
   * Get a path prefix for all content files to be loaded from.
   *
   * @return string
   *   The path for where all content files will be loaded from.
   */
  public function getContentPath();

  /**
   * Parse the given yaml content file into an array.
   *
   * @param string $content_file
   *   A file name for the content file to be loaded. The file is assumed to be
   *   located within a directory set by `setPath()`.
   *
   * @return array
   *   The parsed content array from the file.
   */
  public function parseContent($content_file);

  /**
   * Load all demo content for this loader.
   *
   * @param string $content_file
   *   A file name for the content file to be loaded. The file is assumed to be
   *   located within a directory set by `setPath()`.
   *
   * @return array
   *   An array of created entities.
   */
  public function loadContent($content_file);

  /**
   * Build an entity from the provided content data.
   *
   * @param string $entity_type
   *   The entity type.
   * @param array $content_data
   *   The parsed content data.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The entity returned after building from the parsed content data.
   */
  public function buildEntity($entity_type, array $content_data);

}

Members

Namesort descending Modifiers Type Description Overrides
ContainerInjectionInterface::create public static function Instantiates a new instance of this class. 70
ContentLoaderInterface::buildEntity public function Build an entity from the provided content data. 1
ContentLoaderInterface::getContentPath public function Get a path prefix for all content files to be loaded from. 1
ContentLoaderInterface::loadContent public function Load all demo content for this loader. 1
ContentLoaderInterface::parseContent public function Parse the given yaml content file into an array. 1
ContentLoaderInterface::setContentPath public function Set a path prefix for all content files to be loaded from. 1