You are here

interface FieldHandlerInterface in CMS Content Sync 2.1.x

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

Specifies the publicly available methods of a field handler plugin that can be used to push and pull fields with Sync Core.

Hierarchy

Expanded class hierarchy of FieldHandlerInterface

All classes that implement FieldHandlerInterface

See also

\Drupal\cms_content_sync\Annotation\FieldHandler

\Drupal\cms_content_sync\Plugin\FieldHandlerBase

\Drupal\cms_content_sync\Plugin\Type\FieldHandlerPluginManager

\Drupal\cms_content_sync\Entity\Flow

Plugin API

File

src/Plugin/FieldHandlerInterface.php, line 24

Namespace

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

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

  /**
   * Get the allowed push options.
   *
   * Get a list of all allowed push options for this field. You can
   * either allow {@see PushIntent::PUSH_DISABLED} or
   * {@see PushIntent::PUSH_DISABLED} and
   * {@see PushIntent::PUSH_AUTOMATICALLY}.
   *
   * @return string[]
   */
  public function getAllowedPushOptions();

  /**
   * Get the allowed pull options.
   *
   * Get a list of all allowed pull options for this field. You can
   * either allow {@see PullIntent::PULL_DISABLED} or
   * {@see PullIntent::PULL_DISABLED} and
   * {@see PullIntent::PULL_AUTOMATICALLY}.
   *
   * @return string[]
   */
  public function getAllowedPullOptions();

  /**
   * 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, string $field_name, $current_values);

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

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

  /**
   * @return string the field name this handler belongs to
   */
  public function getFieldName();

  /**
   * Provide the Sync Core with the right property definition so this field can be stored
   * and synchronized.
   */
  public function definePropertyAtType(IDefineEntityType $type_definition);

}

Members

Namesort descending Modifiers Type Description Overrides
FieldHandlerInterface::definePropertyAtType public function Provide the Sync Core with the right property definition so this field can be stored and synchronized. 1
FieldHandlerInterface::getAllowedPullOptions public function Get the allowed pull options. 1
FieldHandlerInterface::getAllowedPushOptions public function Get the allowed push options. 1
FieldHandlerInterface::getFieldName public function 1
FieldHandlerInterface::getHandlerSettings public function Get the handler settings. 1
FieldHandlerInterface::pull public function 1
FieldHandlerInterface::push public function 1
FieldHandlerInterface::supports public static function Check if this handler supports the given field instance. 10
FieldHandlerInterface::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