You are here

interface AdsenseAdInterface in Google AdSense integration 8

Defines an interface for the adsense ad plugins.

Hierarchy

Expanded class hierarchy of AdsenseAdInterface

All classes that implement AdsenseAdInterface

File

src/AdsenseAdInterface.php, line 10

Namespace

Drupal\adsense
View source
interface AdsenseAdInterface extends PluginInspectionInterface {

  /**
   * Creates the ad object, as specified by the definitions in the parameter.
   *
   * @param array $args
   *   Definitions of the ad object as per the AdsenseAd annotation.
   *
   * @return AdsenseAdBase
   *   Created ad object.
   *
   * @throws \Drupal\Component\Plugin\Exception\PluginException
   *   Exception thrown in the event of problems with the plugin.
   */
  public static function createAd(array $args);

  /**
   * Return the ad content.
   *
   * @return array
   *   ad content
   */
  public function getAdContent();

  /**
   * Return the ad placeholder.
   *
   * @return array
   *   ad placeholder
   */
  public function getAdPlaceholder();

  /**
   * Return the list of available languages.
   *
   * @return array
   *   list of language options with the key used by Google and description.
   */
  public static function adsenseLanguages();

  /**
   * This is the array that holds all ad formats.
   *
   * All it has is a multi-dimensional array indexed by a key, containing the ad
   * type and the description.
   *
   * To add a new code:
   * - Make sure the key is not in use by a different format
   * - Go to Google AdSense
   *   . Get the dimensions
   *   . Get the description
   *
   * @param string $key
   *   Ad key for which the format is needed (optional).
   *
   * @return array
   *   if no key is provided: array of supported ad formats as an array (type,
   *   description).
   *   if a key is provided, the array containing the ad format for that key,
   *   or NULL if there is no ad with that key.
   */
  public static function adsenseAdFormats($key = NULL);

}

Members

Namesort descending Modifiers Type Description Overrides
AdsenseAdInterface::adsenseAdFormats public static function This is the array that holds all ad formats. 3
AdsenseAdInterface::adsenseLanguages public static function Return the list of available languages. 1
AdsenseAdInterface::createAd public static function Creates the ad object, as specified by the definitions in the parameter. 1
AdsenseAdInterface::getAdContent public function Return the ad content. 5
AdsenseAdInterface::getAdPlaceholder public function Return the ad placeholder. 5
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