abstract class ContentAdBase in Google AdSense integration 8
Base class for content AdsenseAd plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\adsense\AdsenseAdBase implements AdsenseAdInterface, ContainerFactoryPluginInterface uses StringTranslationTrait
- class \Drupal\adsense\ContentAdBase
- class \Drupal\adsense\AdsenseAdBase implements AdsenseAdInterface, ContainerFactoryPluginInterface uses StringTranslationTrait
Expanded class hierarchy of ContentAdBase
3 files declare their use of ContentAdBase
- adsense.module in ./
adsense.module - Displays Google AdSense ads on Drupal pages.
- ManagedAd.php in src/
Plugin/ AdsenseAd/ ManagedAd.php - OldCodeAd.php in oldcode/
src/ Plugin/ AdsenseAd/ OldCodeAd.php
File
- src/
ContentAdBase.php, line 8
Namespace
Drupal\adsenseView source
abstract class ContentAdBase extends AdsenseAdBase {
/**
* Ad Format.
*
* @var string
*/
protected $format;
/**
* Provides the width and height of the ad.
*
* @param string $format
* Format of the ad (usually WIDTHxHEIGHT).
*
* @return array|null
* Array with dimensions of the ad, or null if format is not a
*/
public static function dimensions($format) {
if (preg_match('!^(\\d+)x(\\d+)(?:_5)?$!', $format, $matches)) {
return [
$matches[1],
$matches[2],
];
}
return NULL;
}
/**
* Gets the ad format.
*
* @return string
* This ad's format.
*/
public function getFormat() {
return $this->format;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AdsenseAdBase:: |
protected | property | Config factory. | |
AdsenseAdBase:: |
protected | property | Current user. | |
AdsenseAdBase:: |
protected | property | Module handler. | |
AdsenseAdBase:: |
public static | function |
List of available languages. Overrides AdsenseAdInterface:: |
|
AdsenseAdBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
AdsenseAdBase:: |
public static | function |
Creates the ad object, as specified by the definitions in the parameter. Overrides AdsenseAdInterface:: |
|
AdsenseAdBase:: |
public | function | Display ad HTML. | |
AdsenseAdBase:: |
public static | function | Check if ads display is disabled. | |
AdsenseAdBase:: |
public | function |
Creates a new AdsenseAdBase instance. Overrides PluginBase:: |
5 |
AdsenseAdInterface:: |
public static | function | This is the array that holds all ad formats. | 3 |
AdsenseAdInterface:: |
public | function | Return the ad content. | 5 |
AdsenseAdInterface:: |
public | function | Return the ad placeholder. | 5 |
ContentAdBase:: |
protected | property | Ad Format. | |
ContentAdBase:: |
public static | function | Provides the width and height of the ad. | |
ContentAdBase:: |
public | function | Gets the ad format. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |