You are here

function dfp_tag_ui::list_build_row in Doubleclick for Publishers (DFP) 7

Same name and namespace in other branches
  1. 7.2 plugins/export_ui/dfp_tag_ui.class.php \dfp_tag_ui::list_build_row()

Build a row based on the item.

By default all of the rows are placed into a table by the render method, so this is building up a row suitable for theme('table'). This doesn't have to be true if you override both.

Overrides ctools_export_ui::list_build_row

File

plugins/export_ui/dfp_tag_ui.class.php, line 32
A custom Ctools Export UI class for DFP Tags.

Class

dfp_tag_ui
Customizations of the DART Tags UI.

Code

function list_build_row($item, &$form_state, $operations) {

  // Warn users if network id has no value. This can happen immediatly after
  // the module is installed.
  if (variable_get('dfp_network_id', '') == '') {
    drupal_set_message(t('DFP ad tags will not work until you have <a href="/admin/structure/dfp_ads/settings">set your network id</a> as provided by Google.'), 'warning', FALSE);
  }

  // Set up sorting
  $name = $item->{$this->plugin['export']['key']};
  $schema = ctools_export_get_schema($this->plugin['schema']);
  switch ($form_state['values']['order']) {
    case 'disabled':
      $this->sorts[$name] = empty($item->disabled) . $name;
      break;
    case 'name':
      $this->sorts[$name] = $name;
      break;
    case 'storage':
      $this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
      break;
  }
  $this->rows[$name]['data'] = array();
  $this->rows[$name]['class'] = !empty($item->disabled) ? array(
    'ctools-export-ui-disabled',
  ) : array(
    'ctools-export-ui-enabled',
  );
  $this->rows[$name]['data'][] = array(
    'data' => check_plain($item->slot),
    'class' => array(
      'ctools-export-ui-slot',
    ),
  );
  $this->rows[$name]['data'][] = array(
    'data' => check_plain($item->size),
    'class' => array(
      'ctools-export-ui-size',
    ),
  );
  $this->rows[$name]['data'][] = array(
    'data' => check_plain($item->block) ? t('Yes') : t('No'),
    'class' => array(
      'ctools-export-ui-block',
    ),
  );
  $this->rows[$name]['data'][] = array(
    'data' => check_plain($item->{$schema['export']['export type string']}),
    'class' => array(
      'ctools-export-ui-storage',
    ),
  );
  $ops = theme('links__ctools_dropbutton', array(
    'links' => $operations,
    'attributes' => array(
      'class' => array(
        'links',
        'inline',
      ),
    ),
  ));
  $this->rows[$name]['data'][] = array(
    'data' => $ops,
    'class' => array(
      'ctools-export-ui-operations',
    ),
  );
}