You are here

interface EntityHandlerInterface in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/EntityHandlerInterface.php \Drupal\cms_content_sync\Plugin\EntityHandlerInterface
  2. 2.0.x src/Plugin/EntityHandlerInterface.php \Drupal\cms_content_sync\Plugin\EntityHandlerInterface

Specifies the publicly available methods of an entity handler plugin that can be used to push and pull entities with Sync Core.

Hierarchy

Expanded class hierarchy of EntityHandlerInterface

All classes that implement EntityHandlerInterface

See also

\Drupal\cms_content_sync\Annotation\EntityHandler

\Drupal\cms_content_sync\Plugin\EntityHandlerBase

\Drupal\cms_content_sync\Plugin\Type\EntityHandlerPluginManager

\Drupal\cms_content_sync\Entity\Flow

Plugin API

File

src/Plugin/EntityHandlerInterface.php, line 23

Namespace

Drupal\cms_content_sync\Plugin
View source
interface EntityHandlerInterface extends PluginInspectionInterface {

  /**
   * Check if this handler supports the given entity type.
   *
   * @param string $entity_type
   * @param string $bundle
   *
   * @return bool
   */
  public static function supports($entity_type, $bundle);

  /**
   * Get the allowed push options.
   *
   * Get a list of all allowed push options for this entity.
   *
   * @see Flow::PUSH_*
   *
   * @return string[]
   */
  public function getAllowedPushOptions();

  /**
   * Get the allowed pull options.
   *
   * Get a list of all allowed pull options for this field.
   *
   * @see Flow::PULL_*
   *
   * @return string[]
   */
  public function getAllowedPullOptions();

  /**
   * @return string[]
   *                  Provide the allowed preview options used for display when manually
   *                  pulling entities
   */
  public function getAllowedPreviewOptions();

  /**
   * Get the handler settings.
   *
   * Return the actual form elements for any additional settings for this
   * handler.
   *
   * @param array  $current_values
   *                               The current values that the user set, if any
   * @param string $type:
   *                               One of 'pull', 'push', 'both'
   *
   * @return array
   */
  public function getHandlerSettings($current_values, $type = 'both');

  /**
   * Validate the settings defined above. $form and $form_state are the same as
   * in the Form API.
   *
   * @param string $settings_key
   * @param array $current_values
   *
   * @return mixed
   */
  public function validateHandlerSettings(array &$form, FormStateInterface $form_state, string $entity_type_name, string $bundle_name, $current_values);

  /**
   * Update the entity type definition.
   *
   * Advanced entity type definition settings for the Sync Core. You
   * can usually ignore these.
   *
   * @param \EdgeBox\SyncCore\Interfaces\Configuration\IDefineEntityType $definition
   *                                                                                 The definition to be sent to Sync Core.
   *                                                                                 {@see SyncCoreExport}.
   */
  public function updateEntityTypeDefinition(&$definition);

  /**
   * Provide a list of fields that are not allowed to be pushed or pulled.
   * These fields typically contain all label fields that are pushed
   * separately anyway (we don't want to set IDs and revision IDs of entities
   * for example, but only use the UUID for references).
   *
   * @return string[]
   */
  public function getForbiddenFields();

  /**
   * @throws \Drupal\cms_content_sync\Exception\SyncException
   *
   * @return bool
   *              Whether or not the content has been pulled. FALSE is a desired state,
   *              meaning nothing should be pulled according to config.
   */
  public function pull(PullIntent $intent);

  /**
   * @param \Drupal\cms_content_sync\PushIntent $intent
   *                                                    The request to store all relevant info at
   *
   * @throws \Drupal\cms_content_sync\Exception\SyncException
   *
   * @return bool
   *              Whether or not the content has been pushed. FALSE is a desired state,
   *              meaning nothing should be pushed according to config.
   */
  public function push(PushIntent $intent);

  /**
   * @return string
   */
  public function getViewUrl(EntityInterface $entity);

}

Members

Namesort descending Modifiers Type Description Overrides
EntityHandlerInterface::getAllowedPreviewOptions public function 8
EntityHandlerInterface::getAllowedPullOptions public function Get the allowed pull options. 1
EntityHandlerInterface::getAllowedPushOptions public function Get the allowed push options. 1
EntityHandlerInterface::getForbiddenFields public function Provide a list of fields that are not allowed to be pushed or pulled. These fields typically contain all label fields that are pushed separately anyway (we don't want to set IDs and revision IDs of entities for example, but only use the UUID for… 1
EntityHandlerInterface::getHandlerSettings public function Get the handler settings. 1
EntityHandlerInterface::getViewUrl public function 1
EntityHandlerInterface::pull public function 1
EntityHandlerInterface::push public function 1
EntityHandlerInterface::supports public static function Check if this handler supports the given entity type. 8
EntityHandlerInterface::updateEntityTypeDefinition public function Update the entity type definition. 1
EntityHandlerInterface::validateHandlerSettings public function Validate the settings defined above. $form and $form_state are the same as in the Form API. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2