fieldry-1.0.x-dev/src/Plugin/FieldryWrapperManagerInterface.php

src/Plugin/FieldryWrapperManagerInterface.php
<?php

namespace Drupal\fieldry\Plugin;

use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Field\FormatterInterface;
use Drupal\Core\Field\FieldDefinitionInterface;

/**
 * Interface for fieldry_wrapper plugin manager.
 *
 * Field wrappers support a method ::getFieldWrappers() to fetching the list of
 * field wrappers which are valid for a field formatter and field definition.
 */
interface FieldryWrapperManagerInterface extends PluginManagerInterface {

  /**
   * Get a list of all the theme hook names used by fieldry wrappers.
   *
   * Get the list of all theme hooks used by fieldry wrappers. This is used in
   * the fieldry hook_theme_registry_alter() to ensure they all include the
   * default field preprocess callbacks so baseline field variables are applied.
   *
   * @return string[]
   *   Names of all the theme hooks (e.g. "fieldry_wrapper") used by all the
   *   fieldry wrapper plugins.
   *
   * @see fieldry_theme_registry_alter()
   */
  public function getThemeHooks(): array;

  /**
   * Fetch the list of field wrappers that apply.
   *
   * @param \Drupal\Core\Field\FormatterInterface $formatter
   *   The field formatter the settings are for.
   * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition
   *   The field definition of the field the display settings are targeting.
   *
   * @return array
   *   An array of field wrappers that can be used with this formatter and
   *   entity field.
   */
  public function getFieldWrappers(FormatterInterface $formatter, FieldDefinitionInterface $field_definition): array;

  /**
   * Get the field wrapper plugin for the renderable element.
   *
   * @param array $element
   *   The field render element to get the field wrapper plugin for.
   *
   * @return \Drupal\fieldry\Plugin\WrapperInterface|null
   *   A field wrapper plugin if a wrapper is available for the field element
   *   information, or NULL if not wrapper should be used or can be found.
   */
  public function getByElement(array $element): ?WrapperInterface;

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc