public function ManagedAd::__construct in Google AdSense integration 8
Creates a new AdsenseAdBase instance.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed|null $plugin_definition: The plugin implementation definition.
\Drupal\Core\Config\ConfigFactoryInterface|null $config_factory: The config factory.
\Drupal\Core\Extension\ModuleHandlerInterface|null $module_handler: The module handler.
\Drupal\Core\Session\AccountProxyInterface|null $current_user: The current user.
Overrides AdsenseAdBase::__construct
File
- src/
Plugin/ AdsenseAd/ ManagedAd.php, line 44
Class
- ManagedAd
- Provides an AdSense managed ad unit.
Namespace
Drupal\adsense\Plugin\AdsenseAdCode
public function __construct(array $configuration, $plugin_id = '', $plugin_definition = NULL, $config_factory = NULL, $module_handler = NULL, $current_user = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $config_factory, $module_handler, $current_user);
$fo = !empty($configuration['format']) ? $configuration['format'] : '';
$sl = !empty($configuration['slot']) ? $configuration['slot'] : '';
$sh = !empty($configuration['shape']) ? $configuration['shape'] : [
'auto',
];
$lk = !empty($configuration['layout_key']) ? $configuration['layout_key'] : '';
if (substr($fo, 0, 10) != 'Search Box' && !empty($fo) && !empty($sl)) {
$this->format = $fo;
$this->slot = $sl;
$this->shape = $sh;
$this->layoutKey = $lk;
}
}