You are here

protected function ShareMessage::getTokenizedField in Share Message 7

Gets a field value and runs it through token_replace().

Parameters

$field_name:

$context:

$default:

Return value

If existent, the field value with tokens replace, the default otherwise.

7 calls to ShareMessage::getTokenizedField()
ShareMessage::addOGTags in includes/sharemessage.entity.inc
Function that adds OG tags in the header of the page.
ShareMessage::addTwitterCardTags in includes/sharemessage.entity.inc
Adds meta tags in order to share images on Twitter.
ShareMessage::buildAdditionalAttributes in includes/sharemessage.entity.inc
Function that adds icon style with addThis:attributes (url, title, description) as part of addThis widget.
ShareMessage::buildContent in includes/sharemessage.entity.inc
Overrides Entity::buildContent().
ShareMessage::build_services_part in includes/sharemessage.entity.inc
Function that adds services as part of addThis widget.

... See full list

File

includes/sharemessage.entity.inc, line 285
Definition of ShareMessage entity class.

Class

ShareMessage

Code

protected function getTokenizedField($field_name, $context, $default = '') {
  global $language;
  if ($items = field_get_items('sharemessage', $this, $field_name)) {

    // Strip tags and replace tokens, removing not resolved tokens from output
    // and preventing double sanitizing as it already happens during rendering.
    return strip_tags(token_replace($items[0]['value'], $context, array(
      'clear' => TRUE,
      'sanitize' => FALSE,
      'language' => $language,
    )));
  }
  return $default;
}