You are here

class ShareMessage in Share Message 8

Entity class for the Share Message entity.

Plugin annotation


@ConfigEntityType(
  id = "sharemessage",
  label = @Translation("Share Message"),
  handlers = {
    "access" = "Drupal\sharemessage\Entity\Handler\ShareMessageAccessControlHandler",
    "view_builder" = "Drupal\sharemessage\Entity\Handler\ShareMessageViewBuilder",
    "list_builder" = "Drupal\sharemessage\Entity\Handler\ShareMessageListBuilder",
    "form" = {
      "add" = "Drupal\sharemessage\Form\ShareMessageForm",
      "edit" = "Drupal\sharemessage\Form\ShareMessageForm",
      "delete" = "Drupal\Core\Entity\EntityDeleteForm"
    }
  },
  entity_keys = {
    "id" = "id",
    "label" = "label"
  },
  config_export = {
    "id",
    "label",
    "title",
    "message_long",
    "message_short",
    "image_url",
    "image_width",
    "image_height",
    "fallback_image",
    "video_url",
    "share_url",
    "plugin",
    "enforce_usage",
    "settings",
    "extra_field_entity_type",
    "extra_field_bundles",
  },
  links = {
    "edit-form" = "/admin/config/services/sharemessage/manage/{sharemessage}",
    "delete-form" = "/admin/config/services/sharemessage/manage/{sharemessage}/delete",
    "collection" = "/admin/config/services/sharemessage",
  }
)

Hierarchy

Expanded class hierarchy of ShareMessage

1 file declares its use of ShareMessage
sharemessage.module in ./sharemessage.module
New Sharing Module.

File

src/Entity/ShareMessage.php, line 57

Namespace

Drupal\sharemessage\Entity
View source
class ShareMessage extends ConfigEntityBase implements ShareMessageInterface {

  /**
   * The machine name of this Share Message.
   *
   * @var string
   */
  public $id;

  /**
   * The label of the Share Message.
   *
   * @var string
   */
  public $label;

  /**
   * The flag for enforcing the usage of the Share Message.
   *
   * @var string
   */
  public $enforce_usage;

  /**
   * The settings of the Share Message.
   *
   * @var string
   */
  public $settings;

  /**
   * The title of the Share Message.
   *
   * @var string
   */
  public $title;

  /**
   * The long share text of the Share Message.
   *
   * @var string
   */
  public $message_long;

  /**
   * The short text of the Share Message, used for twitter.
   *
   * @var string
   */
  public $message_short;

  /**
   * The image URL that will be used for sharing.
   *
   * @var string
   */
  public $image_url;

  /**
   * The width of the image that will be used for sharing.
   *
   * @var string
   */
  public $image_width;

  /**
   * The height of the image that will be used for sharing.
   *
   * @var string
   */
  public $image_height;

  /**
   * An optional fallback image as file UUID if the image URL does not resolve.
   *
   * @var string
   */
  public $fallback_image;

  /**
   * A video URL to use for sharing.
   *
   * @var string
   */
  public $video_url;

  /**
   * Specific URL that will be shared, defaults to the current page
   *
   * @var string
   */
  public $share_url;

  /**
   * Share plugin ID.
   *
   * @var string
   */
  protected $plugin;

  /**
   * The entity type to filter its bundles to display on the UI.
   *
   * @var string
   */
  protected $extra_field_entity_type;

  /**
   * The entity types bundles where the Share Message will be displayed.
   *
   * @var string[]
   */
  protected $extra_field_bundles = [];

  /**
   * The runtime token context.
   *
   * @var array
   */
  protected $runtimeContext = [];

  /**
   * {@inheritdoc}
   */
  public function setLabel($label) {
    $this
      ->set('label', $label);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setTitle($title) {
    $this
      ->set('title', $title);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getPlugin() {
    return \Drupal::service('plugin.manager.sharemessage.share')
      ->createInstance($this->plugin, [
      'sharemessage' => $this,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginId() {
    return $this->plugin;
  }

  /**
   * {@inheritdoc}
   */
  public function setPluginID($plugin_id) {
    $this->plugin = $plugin_id;
  }

  /**
   * {@inheritdoc}
   */
  public function hasPlugin() {
    if (!empty($this->plugin) && \Drupal::service('plugin.manager.sharemessage.share')
      ->hasDefinition($this->plugin)) {
      return TRUE;
    }
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginDefinition() {

    /** @var \Drupal\sharemessage\SharePluginBase $share_plugin */
    $share_plugin = $this
      ->getPlugin();
    return $share_plugin
      ->getPluginDefinition();
  }

  /**
   * {@inheritdoc}
   */
  public function getSetting($key) {
    if (!empty($this->settings[$key])) {
      return $this->settings[$key];
    }
  }

  /**
   * {@inheritdoc}
   */
  public function setRuntimeContext(array $context) {
    $this->runtimeContext = $context;
  }

  /**
   * {@inheritdoc}
   */
  public function getContext($view_mode = 'full') {
    $context = [
      'sharemessage' => $this,
      'view_mode' => $view_mode,
    ];

    // Add a runtime context to the context list.
    $context += $this->runtimeContext;

    // Attempt to use the current node as context if none has been set
    // explicitly as runtime context.
    $node = \Drupal::request()->attributes
      ->get('node');
    if (!isset($context['node']) && $node instanceof NodeInterface) {
      $context['node'] = $node;
    }

    // Let other modules alter the sharing context that will be used for token
    // as base for replacements.
    \Drupal::moduleHandler()
      ->alter('sharemessage_token_context', $this, $context);
    return $context;
  }

  /**
   * {@inheritdoc}
   */
  public function buildOGTags($context) {
    $tags = [];

    // Base value for og:type meta tag.
    // @todo don't hardcode this, make configurable per Share Message entity.
    $type = 'website';

    // OG: Title.
    $tags[] = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'property' => 'og:title',
        'content' => $this
          ->getTokenizedField($this->title, $context),
      ],
    ];

    // OG: Image, also used for video thumbnail.
    if ($image_url = $this
      ->getImageUrl($context, $fallback_image)) {
      $tags[] = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'property' => 'og:image',
          'content' => $image_url,
        ],
      ];
      $image_width = NULL;
      $image_height = NULL;
      if ($fallback_image instanceof FileInterface) {
        if (file_exists($fallback_image
          ->getFileUri())) {
          $image = \Drupal::service('image.factory')
            ->get($fallback_image
            ->getFileUri());
          if ($image
            ->isValid()) {
            $image_width = $image
              ->getWidth();
            $image_height = $image
              ->getHeight();
          }
        }
      }
      else {
        $image_width = $this
          ->getTokenizedField($this->image_width, $context);
        $image_height = $this
          ->getTokenizedField($this->image_height, $context);
      }
      if ($image_width && $image_height) {
        $tags[] = [
          '#type' => 'html_tag',
          '#tag' => 'meta',
          '#attributes' => [
            'property' => 'og:image:width',
            'content' => $image_width,
          ],
        ];
        $tags[] = [
          '#type' => 'html_tag',
          '#tag' => 'meta',
          '#attributes' => [
            'property' => 'og:image:height',
            'content' => $image_height,
          ],
        ];
      }
    }

    // OG: Video.
    if ($video_url = $this
      ->getTokenizedField($this->video_url, $context)) {
      $tags[] = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'property' => 'og:video',
          'content' => $video_url . '?fs=1',
        ],
      ];
      $tags[] = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'property' => 'og:video:width',
          'content' => \Drupal::config('sharemessage.addthis')
            ->get('shared_video_width'),
        ],
      ];
      $tags[] = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'property' => 'og:video:height',
          'content' => \Drupal::config('sharemessage.addthis')
            ->get('shared_video_height'),
        ],
      ];
      $tags[] = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'property' => 'og:video:type',
          'content' => 'application/x-shockwave-flash',
        ],
      ];

      // Override og:type to video.
      $type = 'video';
    }

    // OG: URL.
    $tags[] = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'property' => 'og:url',
        'content' => $this
          ->getUrl($context),
      ],
    ];

    // OG: Description.
    $tags[] = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'property' => 'og:description',
        'content' => $this
          ->getTokenizedField($this->message_long, $context),
      ],
    ];

    // OG: Type.
    $tags[] = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'property' => 'og:type',
        'content' => $type,
      ],
    ];
    return $tags;
  }

  /**
   * Adds meta tags in order to share images on Twitter.
   *
   * @param array $context
   *   The context for the token replacements.
   *
   * @return array
   *   The twitter tags.
   */
  public function buildTwitterCardTags($context) {
    $twitter = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'twitter:card',
        'content' => 'summary_large_image',
      ],
    ];
    $tags[] = [
      $twitter,
      'twitter_card',
    ];
    $twitter = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'twitter:site',
        'content' => \Drupal::config('sharemessage.settings')
          ->get('twitter_user'),
      ],
    ];
    $tags[] = [
      $twitter,
      'twitter_site',
    ];
    $twitter = [
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => [
        'name' => 'twitter:description',
        'content' => $this
          ->getTokenizedField($this->message_long, $context),
      ],
    ];
    $tags[] = [
      $twitter,
      'twitter_description',
    ];
    if ($image_url = $this
      ->getImageUrl($context)) {
      $twitter = [
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => [
          'name' => 'twitter:image',
          'content' => $image_url,
        ],
      ];
      $tags[] = [
        $twitter,
        'twitter_image',
      ];
    }
    return $tags;
  }

  /**
   * {@inheritdoc}
   */
  public function getTokenizedField($property_value, $context, $default = '') {
    if ($property_value) {
      return strip_tags(PlainTextOutput::renderFromHtml(\Drupal::token()
        ->replace($property_value, $context, [
        'clear' => TRUE,
      ])));
    }
    return $default;
  }

  /**
   * {@inheritdoc}
   */
  public function getUrl($context) {
    $options = [
      'absolute' => TRUE,
    ];
    if ($this->enforce_usage) {
      $options['query'] = [
        'smid' => $this->id,
      ];
    }
    $uri = $this
      ->getTokenizedField($this->share_url, $context, Url::fromRoute('<current>')
      ->getInternalPath());
    if (strpos($uri, '://') !== FALSE) {
      return Url::fromUri($uri, $options)
        ->toString();
    }
    elseif ($url = \Drupal::pathValidator()
      ->getUrlIfValid($uri)) {
      return $url
        ->setAbsolute()
        ->toString();
    }
    else {
      return Url::fromUri('internal:/' . $uri, $options)
        ->toString();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getExtraFieldEntityType() {
    return $this->extra_field_entity_type;
  }

  /**
   * {@inheritdoc}
   */
  public function setExtraFieldEntityType($extra_field_entity_type) {
    $this->extra_field_entity_type = $extra_field_entity_type;
  }

  /**
   * {@inheritdoc}
   */
  public function getExtraFieldBundles() {
    return $this->extra_field_bundles;
  }

  /**
   * {@inheritdoc}
   */
  public function setExtraFieldBundles(array $extra_field_bundles) {
    $this->extra_field_bundles = $extra_field_bundles;
  }

  /**
   * Gets the image url of the ShareMessage.
   *
   * @param array $context
   *   The context for the token replacements.
   * @param \Drupal\file\FileInterface|null $fallback_image
   *   By-reference argument that holds the fallback image reference if that
   *   was used.
   *
   * @return bool|string
   *   The found URL or FALSE.
   */
  protected function getImageUrl($context, &$fallback_image = NULL) {

    // Get image url either from dedicated file field or by resolving token.
    $image_url = $this
      ->getTokenizedField($this->image_url, $context);

    // If the returned image URl is empty, try to use the fallback image if
    // one is defined.
    if (!$image_url && !empty($this->fallback_image)) {
      $entity_repository = \Drupal::getContainer()
        ->get('entity.repository');

      /** @var \Drupal\file\FileInterface $image */
      $fallback_image = $entity_repository
        ->loadEntityByUuid('file', $this->fallback_image);
      if ($fallback_image) {
        $image_url = file_create_url($fallback_image
          ->getFileUri());
      }
    }
    return $image_url;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$uuid protected property The UUID for this entity.
ConfigEntityBase::$_core protected property Information maintained by Drupal core about configuration.
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface::calculateDependencies 13
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isNew public function Overrides Entity::isNew(). Overrides EntityBase::isNew
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase::link
ConfigEntityBase::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface::onDependencyRemoval 7
ConfigEntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase::preDelete 8
ConfigEntityBase::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityBase::preSave 13
ConfigEntityBase::save public function Saves an entity permanently. Overrides EntityBase::save 1
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::sort public static function Helper callback for uasort() to sort configuration entities by weight and label. 6
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray 2
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::url public function Gets the public URL for this entity. Overrides EntityBase::url
ConfigEntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityBase::urlInfo
ConfigEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct 10
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 16
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave 14
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
ShareMessage::$enforce_usage public property The flag for enforcing the usage of the Share Message.
ShareMessage::$extra_field_bundles protected property The entity types bundles where the Share Message will be displayed.
ShareMessage::$extra_field_entity_type protected property The entity type to filter its bundles to display on the UI.
ShareMessage::$fallback_image public property An optional fallback image as file UUID if the image URL does not resolve.
ShareMessage::$id public property The machine name of this Share Message.
ShareMessage::$image_height public property The height of the image that will be used for sharing.
ShareMessage::$image_url public property The image URL that will be used for sharing.
ShareMessage::$image_width public property The width of the image that will be used for sharing.
ShareMessage::$label public property The label of the Share Message.
ShareMessage::$message_long public property The long share text of the Share Message.
ShareMessage::$message_short public property The short text of the Share Message, used for twitter.
ShareMessage::$plugin protected property Share plugin ID.
ShareMessage::$runtimeContext protected property The runtime token context.
ShareMessage::$settings public property The settings of the Share Message.
ShareMessage::$share_url public property Specific URL that will be shared, defaults to the current page
ShareMessage::$title public property The title of the Share Message.
ShareMessage::$video_url public property A video URL to use for sharing.
ShareMessage::buildOGTags public function Returns Open Graph meta tags for <head>. Overrides ShareMessageInterface::buildOGTags
ShareMessage::buildTwitterCardTags public function Adds meta tags in order to share images on Twitter. Overrides ShareMessageInterface::buildTwitterCardTags
ShareMessage::getContext public function Gets a context for tokenizing. Overrides ShareMessageInterface::getContext
ShareMessage::getExtraFieldBundles public function Gets the enabled entity type bundles list. Overrides ShareMessageInterface::getExtraFieldBundles
ShareMessage::getExtraFieldEntityType public function Gets the selected entity type. Overrides ShareMessageInterface::getExtraFieldEntityType
ShareMessage::getImageUrl protected function Gets the image url of the ShareMessage.
ShareMessage::getPlugin public function Returns the plugin instance. Overrides ShareMessageInterface::getPlugin
ShareMessage::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides ShareMessageInterface::getPluginDefinition
ShareMessage::getPluginId public function Returns the Share Message plugin ID. Overrides ShareMessageInterface::getPluginId
ShareMessage::getSetting public function Gets the default settings. Overrides ShareMessageInterface::getSetting
ShareMessage::getTokenizedField public function Tokenizes a field, if it is set. Overrides ShareMessageInterface::getTokenizedField
ShareMessage::getUrl public function Gets the Share Message URL. Overrides ShareMessageInterface::getUrl
ShareMessage::hasPlugin public function Checks whether the Share Message plugin of this Share Message exists. Overrides ShareMessageInterface::hasPlugin
ShareMessage::setExtraFieldBundles public function Sets the enabled entity type bundles list. Overrides ShareMessageInterface::setExtraFieldBundles
ShareMessage::setExtraFieldEntityType public function Sets the selected entity type. Overrides ShareMessageInterface::setExtraFieldEntityType
ShareMessage::setLabel public function Sets the internal Share Message label. Overrides ShareMessageInterface::setLabel
ShareMessage::setPluginID public function Sets the plugin ID. Overrides ShareMessageInterface::setPluginID
ShareMessage::setRuntimeContext public function Sets an additional runtime context for tokenizing. Overrides ShareMessageInterface::setRuntimeContext
ShareMessage::setTitle public function Sets the Share Message title used when sharing. Overrides ShareMessageInterface::setTitle
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function