You are here

function dfp_tag in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 dfp.module \dfp_tag()

Return a render array for the tag specified by machinename.

4 calls to dfp_tag()
dfp_adtest_page in ./dfp.adtest.inc
Page callback for the DFP test page. It displays all tags on the site.
dfp_block_view in ./dfp.module
Implements hook_block_view().
dfp_dfp_pane_render in plugins/content_types/dfp_pane.inc
Output function for the 'DFP Panel' content type.
dfp_page_build in ./dfp.module
Implements of hook_page_build().
6 string references to 'dfp_tag'
dfp_admin_settings in ./dfp.admin.inc
Form builder for the global DFP settings form.
dfp_adtest_form in ./dfp.adtest.inc
Build a form for display at the top of the adtest page allowing users to set the adunit pattern for all dfp tags on that page.
dfp_context_reaction_adunit::options_form in plugins/contexts/dfp_context_reaction_adunit.inc
Allow admins to choose what DFP adunit to override.
dfp_tag_form in plugins/export_ui/dfp_ctools_export_ui.inc
Form builder; Create an ad tag.
dfp_tokens in ./dfp.module
Implements hook_tokens().

... See full list

File

./dfp.module, line 410

Code

function dfp_tag($machinename) {
  $tag = dfp_tag_load($machinename);
  $render_array = array();
  if (!$tag) {
    watchdog('dfp', 'Unknown ad tag %machinename passed to dfp_tag().', array(
      '%machinename' => $machinename,
    ), WATCHDOG_WARNING);
  }
  else {
    $tag->slug = dfp_format_slug($tag->slug);
    $slug_placement = variable_get('dfp_slug_placement', 0);
    if (!empty($tag)) {
      $render_array = array(
        'dfp_wrapper' => array(
          '#type' => 'container',
          '#attributes' => array(
            'id' => $tag->wrapper_id,
            'class' => array(
              'dfp-tag-wrapper',
            ),
          ),
          'tag' => array(
            '#theme' => $tag->short_tag ? 'dfp_short_tag' : 'dfp_tag',
            '#tag' => $tag,
          ),
        ),
      );
      if (!empty($tag->slug) && $slug_placement == 0) {
        $render_array['dfp_wrapper']['slug_wrapper'] = array(
          '#type' => 'container',
          '#attributes' => array(
            'class' => array(
              'slug',
            ),
          ),
          'slug' => array(
            '#markup' => check_plain($tag->slug),
          ),
          '#weight' => -1,
        );
      }
    }
  }
  return $render_array;
}