class dfp_context_reaction_settings in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 plugins/contexts/dfp_context_reaction_settings.inc \dfp_context_reaction_settings
Expose DFP variables as context reactions.
Hierarchy
- class \context_reaction
Expanded class hierarchy of dfp_context_reaction_settings
2 string references to 'dfp_context_reaction_settings'
- 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_settings.inc, line 11 - Context reaction plugin for DFP ads.
View source
class dfp_context_reaction_settings extends context_reaction {
/**
* Allow admins to choose what DART tags to hide.
*/
function options_form($context) {
module_load_include('inc', 'dfp', 'dfp.admin');
// Get existing values for this form.
$values = $this
->fetch_from_context($context);
// Build the targeting form.
$form = array();
_dfp_targeting_form($form, isset($values['targeting']) ? $values['targeting'] : array());
// Modify the #parents property to make sure values are stored in the
// location that contexts expects them.
$parents = array(
'reactions',
'plugins',
'dfp_settings',
);
foreach (element_children($form['targeting']) as $key) {
if (is_numeric($key)) {
$form['targeting'][$key]['target']['#parents'] = array_merge($parents, $form['targeting'][$key]['target']['#parents']);
$form['targeting'][$key]['value']['#parents'] = array_merge($parents, $form['targeting'][$key]['value']['#parents']);
}
}
// Modify form to call the contexts-specific versions of certain functions.
$form['targeting']['dfp_more_targets']['#submit'] = array(
'dfp_contexts_more_targets_submit',
);
$form['targeting']['dfp_more_targets']['#ajax']['callback'] = 'dfp_contexts_more_targets_js';
return $form;
}
/**
* Return a keyed array containing the settings.
*/
function execute(&$tag) {
foreach ($this
->get_contexts() as $context_name => $context) {
foreach ($context->reactions['dfp_settings']['targeting'] as $key => $value) {
$tag->settings['targeting'][] = $value;
}
}
}
}
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_settings:: |
function | Return a keyed array containing the settings. | ||
dfp_context_reaction_settings:: |
function |
Allow admins to choose what DART tags to hide. Overrides context_reaction:: |