You are here

interface JsonapiHelperInterface in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/src/Service/JsonapiHelperInterface.php \Drupal\entity_share_client\Service\JsonapiHelperInterface
  2. 8.2 modules/entity_share_client/src/Service/JsonapiHelperInterface.php \Drupal\entity_share_client\Service\JsonapiHelperInterface

Remote manager interface methods.

Hierarchy

Expanded class hierarchy of JsonapiHelperInterface

All classes that implement JsonapiHelperInterface

1 file declares its use of JsonapiHelperInterface
PullForm.php in modules/entity_share_client/src/Form/PullForm.php

File

modules/entity_share_client/src/Service/JsonapiHelperInterface.php, line 11

Namespace

Drupal\entity_share_client\Service
View source
interface JsonapiHelperInterface {

  /**
   * Prepare entities from an URI to request.
   *
   * @param array $json_data
   *   An array of data send by the JSON API..
   *
   * @return array
   *   The array of options for the tableselect form type element.
   */
  public function buildEntitiesOptions(array $json_data);

  /**
   * Helper function to unserialize an entity from the JSON API response.
   *
   * TODO: Should this method be removed from the interface?
   *
   * @param array $data
   *   An array of data.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   An unserialize entity.
   */
  public function extractEntity(array $data);

  /**
   * Create or update the entity reference field values of an entity.
   *
   * TODO: Should this method be removed from the interface?
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity to update.
   * @param array $data
   *   An array of data.
   */
  public function updateRelationships(ContentEntityInterface $entity, array $data);

  /**
   * Create or update the entity reference field values of an entity.
   *
   * TODO: Should this method be removed from the interface?
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity to update.
   * @param array $data
   *   An array of data. Can be modified to change the URI if needed.
   */
  public function handlePhysicalFiles(ContentEntityInterface $entity, array &$data);

  /**
   * Use data from the JSONAPI to import content.
   *
   * @param array $entity_list_data
   *   An array of data from a JSONAPI endpoint.
   *
   * @return int[]
   *   The list of entity ids imported.
   */
  public function importEntityListData(array $entity_list_data);

  /**
   * Set the remote to get content from.
   *
   * @param \Drupal\entity_share_client\Entity\RemoteInterface $remote
   *   The remote website to get content from.
   */
  public function setRemote(RemoteInterface $remote);

  /**
   * Uniformize JSON data in case of single value.
   *
   * @param array $data
   *   The JSON data.
   *
   * @return array
   *   An array of data.
   */
  public function prepareData(array $data);

}

Members

Namesort descending Modifiers Type Description Overrides
JsonapiHelperInterface::buildEntitiesOptions public function Prepare entities from an URI to request. 1
JsonapiHelperInterface::extractEntity public function Helper function to unserialize an entity from the JSON API response. 1
JsonapiHelperInterface::handlePhysicalFiles public function Create or update the entity reference field values of an entity. 1
JsonapiHelperInterface::importEntityListData public function Use data from the JSONAPI to import content. 1
JsonapiHelperInterface::prepareData public function Uniformize JSON data in case of single value. 1
JsonapiHelperInterface::setRemote public function Set the remote to get content from. 1
JsonapiHelperInterface::updateRelationships public function Create or update the entity reference field values of an entity. 1