[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/migrate/ -> migrate.views_default.inc (source)

   1  <?php
   2  // $Id: migrate.views_default.inc,v 1.1.2.5 2009/09/02 18:42:09 mikeryan Exp $
   3  
   4  /**
   5   * @file
   6   * Modify the default views of message tables
   7   */
   8  
   9  /**
  10   * TODO:
  11   * Eventually, we want to create default views combining messages with the content set view
  12   * generating the messages - basically, cloning that view and adding a join to the appropriate
  13   * message table. Those views may or may not be default views. In hook_views_default_views(), we
  14   * cannot load a default view without creating an infinite recursion. In
  15   * hook_views_default_views_alter(), the default views are present but not the others. So,
  16   * we use both hooks to catch all cases.
  17   */
  18  
  19  /**
  20   * Implementation of hook_views_default_views_alter().
  21   */
  22  function migrate_views_default_views_alter(&$views) {
  23    // Go through each content set and alter the Table Wizard's default view for its message
  24    // table to add an argument (level), and alter the access permission
  25    $sql = "SELECT mcsid, view_name, sourcekey FROM {migrate_content_sets}";
  26    $tblresult = db_query($sql);
  27    while ($tblrow = db_fetch_object($tblresult)) {
  28      $viewname = migrate_message_table_name($tblrow->mcsid);
  29      $view = $views[$viewname];
  30      $view->display['default']->display_options['arguments'] = array(
  31        'level' => array(
  32          'id' => 'level',
  33          'field' => 'level',
  34          'table' => $viewname,
  35          'relationship' => 'none',
  36          'default_action' => 'ignore',
  37        ),
  38      );
  39      $view->display['default']->display_options['access'] = array(
  40        'type' => 'perm',
  41        'perm' => MIGRATE_ACCESS_BASIC,
  42      );
  43      // Not interested in displaying these
  44      unset($view->display['default']->display_options['fields']['mceid']);
  45      unset($view->display['default']->display_options['fields']['level']);
  46      $view->display['default']->display_options['title'] =
  47        t('Migration messages for content set !view',
  48          array('!view' => $viewname));
  49  
  50      $view->display['default']->display_options['header'] =
  51        t('Listing of messages reported when importing this content set.');
  52      $views[$viewname] = $view;
  53    }
  54  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7