You are here

interface SocialSimpleGeneratorInterface in Social simple 8

Same name and namespace in other branches
  1. 2.0.x src/SocialSimpleGeneratorInterface.php \Drupal\social_simple\SocialSimpleGeneratorInterface

Interface SocialSimpleGeneratorInterface.

@package Drupal\social_simple

Hierarchy

Expanded class hierarchy of SocialSimpleGeneratorInterface

All classes that implement SocialSimpleGeneratorInterface

File

src/SocialSimpleGeneratorInterface.php, line 12

Namespace

Drupal\social_simple
View source
interface SocialSimpleGeneratorInterface {

  /**
   * Return an array of social networks supported.
   *
   * @return array $networks
   *   An array of Label social networks supported kyed by their id.
   */
  public function getNetworks();

  /**
   * Build the render array of social share links.
   *
   * @param array $networks
   *   An array of social network name keyed with network id.
   * @param string $title
   *   The title to use for the share links.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity if provided.
   * @param array $options
   *   Additional options to pass as a query for the url built.
   *   The array must be keyed by network_id.
   *   Example.
   *   $options = [
   *     'twitter' => [
   *       'hastags' => 'hashtag1, hashtag2',
   *     ],
   *   ];.
   *
   * @return array $links
   *   An array of social share links.
   */
  public function buildSocialLinks(array $networks, $title, EntityInterface $entity = NULL, array $options = []);

  /**
   * Build the social share links.
   *
   * @param array $networks
   *   An array of social network name keyed with network id.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity if provided.
   * @param array $options
   *   Additional options to pass as a query for the url built.
   *   The array must be keyed by network_id.
   *   Example.
   *   $options = [
   *     'twitter' => [
   *       'hastags' => 'hashtag1, hashtag2',
   *     ],
   *   ];.
   *
   * @return array $links
   *   An array of social share links.
   */
  public function generateSocialLinks(array $networks, EntityInterface $entity = NULL, array $options = []);

  /**
   * Get the title to share.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity if provided.
   *
   * @return string $title
   *   The entity title or page title to share.
   */
  public function getTitle(EntityInterface $entity = NULL);

  /**
   * Get the share url.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity if provided.
   *
   * @return string $url
   *   The url to share.
   */
  public function getShareUrl(EntityInterface $entity = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
SocialSimpleGeneratorInterface::buildSocialLinks public function Build the render array of social share links. 1
SocialSimpleGeneratorInterface::generateSocialLinks public function Build the social share links. 1
SocialSimpleGeneratorInterface::getNetworks public function Return an array of social networks supported. 1
SocialSimpleGeneratorInterface::getShareUrl public function Get the share url. 1
SocialSimpleGeneratorInterface::getTitle public function Get the title to share. 1