You are here

function dfp_adtest_page in Doubleclick for Publishers (DFP) 8

Same name and namespace in other branches
  1. 7.2 dfp.adtest.inc \dfp_adtest_page()
  2. 7 dfp.adtest.inc \dfp_adtest_page()

Page callback for the DFP test page. It displays all tags on the site.

File

src/View/dfp.adtest.inc, line 11
Creates a test page for DFP ads.

Code

function dfp_adtest_page() {
  $output = [];
  $form = drupal_get_form('dfp_adtest_form');
  $output[] = [
    '#markup' => render($form),
    '#attached' => [
      'css' => [
        'dfp-admin' => drupal_get_path('module', 'dfp') . '/dfp.admin.css',
      ],
    ],
  ];
  $tags = dfp_tag_load_all();
  foreach ($tags as $tag) {
    $tag_slot = [
      'tag slot name' => [
        '#markup' => '<h3>' . check_plain($tag->slot) . '</h3>',
      ],
    ];
    $tag_tag = dfp_tag($tag->machinename);
    $tag_devel = [];
    if (module_exists('devel')) {
      $tag_devel['object'] = [
        '#markup' => \Drupal::service('devel.dumper')
          ->dumpOrExport($tag, TRUE),
      ];
    }
    $output[] = [
      $tag_slot,
      $tag_tag,
      $tag_devel,
    ];
  }
  return $output;
}