class dfp_context_reaction_sizes in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 plugins/contexts/dfp_context_reaction_sizes.inc \dfp_context_reaction_sizes
Expose DFP tags as context reactions.
Hierarchy
- class \context_reaction
- class \dfp_context_reaction_sizes
Expanded class hierarchy of dfp_context_reaction_sizes
2 string references to 'dfp_context_reaction_sizes'
- dfp_context_plugins in ./
dfp.module - Implements hook_context_plugins().
- dfp_context_registry in ./
dfp.module - Implements hook_context_registry().
File
- plugins/
contexts/ dfp_context_reaction_sizes.inc, line 11 - Context reaction plugin for DFP ads.
View source
class dfp_context_reaction_sizes extends context_reaction {
/**
* Allow admins to choose what DFP adunit to override.
*/
function options_form($context) {
$form = array(
'#theme' => 'dfp_size_settings',
);
// Get existing values for this form.
$values = $this
->fetch_from_context($context);
// Get a list of all DART tags.
$tags = dfp_tag_load_all();
foreach ($tags as $tag) {
$form[$tag->machinename . '_size'] = array(
'#type' => 'textfield',
'#title' => check_plain($tag->slot),
'#title_display' => 'invisible',
'#description' => t('Example: 300x600,300x250'),
'#default_value' => isset($values[$tag->machinename . '_size']) ? $values[$tag->machinename . '_size'] : '',
);
}
return $form;
}
/**
* override all tags based on context.
*/
function execute(&$tag) {
// Check each currently set context to see if the DART tag specified by
// machinename should be overridden or not.
foreach ($this
->get_contexts() as $context_name => $context) {
$new_size = isset($context->reactions['dfp_adsize'][$tag->machinename . '_size']) ? $context->reactions['dfp_adsize'][$tag->machinename . '_size'] : '';
$tag->size = !empty($new_size) ? $new_size : $tag->size;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
function | Retrieve options from the context provided. | 1 | |
context_reaction:: |
function | Retrieve active contexts that have values for this reaction. | ||
context_reaction:: |
function | Options form submit handler. | 3 | |
context_reaction:: |
function | Settings form. Provide variable settings for your reaction. | 2 | |
context_reaction:: |
function | Clone our references when we're being cloned. | ||
context_reaction:: |
function | Constructor. Do not override. | ||
dfp_context_reaction_sizes:: |
function | override all tags based on context. | ||
dfp_context_reaction_sizes:: |
function |
Allow admins to choose what DFP adunit to override. Overrides context_reaction:: |