class AmpQueryParameters in Accelerated Mobile Pages (AMP) 8
Same name and namespace in other branches
- 8.3 src/Utility/AmpQueryParameters.php \Drupal\amp\Utility\AmpQueryParameters
- 8.2 src/Utility/AmpQueryParameters.php \Drupal\amp\Utility\AmpQueryParameters
Class AmpQueryParameters
Adds amp query parameters to a URL.
@package Drupal\amp\Utility
Hierarchy
- class \Drupal\amp\Utility\AmpQueryParameters
Expanded class hierarchy of AmpQueryParameters
1 string reference to 'AmpQueryParameters'
1 service uses AmpQueryParameters
File
- src/Utility/ AmpQueryParameters.php, line 12 
Namespace
Drupal\amp\UtilityView source
class AmpQueryParameters {
  /**
   * Add amp query parameter to a URL.
   *
   * @param string $url
   *   The original URL value.
   * @param boolean $warnfix
   *   Option to append warnfix to the end of the URL.
   *
   * @return string
   *   A url containing the additional amp query parameter(s).
   */
  public function add($url, $warnfix = FALSE) {
    // Append amp query string parameter
    if (strpos($url, '?') === FALSE) {
      $amp_url = $url . "?amp";
    }
    else {
      $amp_url = $url . "&";
    }
    // Append optional warnfix query string parameter.
    if ($warnfix) {
      $amp_url = $amp_url . "&warnfix";
    }
    return $amp_url;
  }
}Members
| Name   | Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| AmpQueryParameters:: | public | function | Add amp query parameter to a URL. | 
