You are here

interface PlatformInterface in Social Media Links Block and Field 8.2

Defines an interface for social media links platform plugins.

Hierarchy

Expanded class hierarchy of PlatformInterface

All classes that implement PlatformInterface

File

src/PlatformInterface.php, line 12

Namespace

Drupal\social_media_links
View source
interface PlatformInterface extends PluginInspectionInterface {

  /**
   * Get the value for the platform.
   *
   * @return string
   *   The value.
   */
  public function getValue();

  /**
   * Set the value for the platform.
   *
   * @param string $value
   *   The value.
   */
  public function setValue($value);

  /**
   * Return the name of the icon.
   *
   * In most cases, the icon name is the id of the platform.
   *
   * @return string
   *   The name of the icon for the platform.
   */
  public function getIconName();

  /**
   * Return the name of the platform.
   *
   * @return string
   *   The name of the platform.
   */
  public function getName();

  /**
   * Returns the description for the value field.
   *
   * @return string
   *   The description of the value field.
   */
  public function getFieldDescription();

  /**
   * Return the url prefix of the platform.
   *
   * @return string
   *   The url prefix.
   */
  public function getUrlPrefix();

  /**
   * Return the url suffix of the platform.
   *
   * @return string
   *   The url suffix.
   */
  public function getUrlSuffix();

  /**
   * Get the full url for the platform.
   *
   * Return the full url, including urlPrefix, user value and urlSuffix
   * This method is useful to change the url to match platform specific
   * requirements.
   * E.g.: "mailto:VALUE" for email platform or "user-path:/" for internal urls.
   *
   * @return \Drupal\Core\Url
   *   Returns the full Url object for the platform.
   */
  public function getUrl();

  /**
   * Generates the final url for the output.
   *
   * @param \Drupal\Core\Url $url
   *   A Url object with the full plattform url.
   *
   * @return string
   *   The url to the platform (with the user value).
   */
  public function generateUrl(Url $url);

  /**
   * Return value for the title and WAI-ARIA attribute.
   *
   * @return string
   *   The description.
   */
  public function getDescription();

  /**
   * Set the description.
   *
   * @param string $description
   *   The description.
   */
  public function setDescription($description);

  /**
   * Validates the user input of a platform before the value is saved.
   *
   * @return mixed
   *   The result of the validation.
   */
  public static function validateValue(array &$element, FormStateInterface $form_state, array $form);

}

Members

Namesort descending Modifiers Type Description Overrides
PlatformInterface::generateUrl public function Generates the final url for the output. 1
PlatformInterface::getDescription public function Return value for the title and WAI-ARIA attribute. 1
PlatformInterface::getFieldDescription public function Returns the description for the value field. 1
PlatformInterface::getIconName public function Return the name of the icon. 1
PlatformInterface::getName public function Return the name of the platform. 1
PlatformInterface::getUrl public function Get the full url for the platform. 1
PlatformInterface::getUrlPrefix public function Return the url prefix of the platform. 1
PlatformInterface::getUrlSuffix public function Return the url suffix of the platform. 1
PlatformInterface::getValue public function Get the value for the platform. 1
PlatformInterface::setDescription public function Set the description. 1
PlatformInterface::setValue public function Set the value for the platform. 1
PlatformInterface::validateValue public static function Validates the user input of a platform before the value is saved. 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