Commit fb3a939d authored by Jonathan DeLaigle's avatar Jonathan DeLaigle
Browse files

Issue #1454426 by Murz, seddonym, and carolalindh. Fixing integration with...

Issue #1454426 by Murz, seddonym, and carolalindh. Fixing integration with views by overriding the built-in embed view and fixing the version information for views
parent ccfb3ed0
Loading
Loading
Loading
Loading
+17 −6
Changes for embed_views.module: 17 added lines, 6 removed lines.
Original line number Diff line number Diff line
<?php

/**
 * @file
 * Integration with the views module to create the new embed views display.
 */

/**
 * Advertise the current views api version
 * Implements hook_views_api().
 */
function embed_views_api_version() {
  return array('version' => 3.0);
function embed_views_views_api() {
  return array("version" => "3.0");
}

/**
@@ -20,7 +19,8 @@ function embed_views_views_plugins() {
    'display' => array(
      'embed' => array(
        'title' => t('Embed'),
        'help' => t('Creates a display specifically for embed.'),
        'help' => t('Creates a display for embed use.'),
        'file' => 'embed_views_plugin_display_embed',
        'handler' => 'embed_views_plugin_display_embed',
        'theme' => 'views_view',
        'theme path' => drupal_get_path('module', 'views') . '/theme',
@@ -44,6 +44,17 @@ function embed_views_form_views_exposed_form_alter(&$form, &$form_state) {
  }
}

/**
 * Implements hook_views_plugins_alter().
 *
 * - Override views' built-in embed display.
 */
function embed_views_views_plugins_alter(&$plugins) {
  $embed_views_display = embed_views_views_plugins();

  $plugins['display']['embed'] = array_merge($plugins['display']['embed'], $embed_views_display['display']['embed']);
}

/**
 * Returns the exposed filter widgets for a view.
 *
@@ -73,6 +84,6 @@ function embed_views_exposed_form($view, $display_id = '') {
    return $exposed_form;
  }
  else {
    watchdog('embed_views', 'You must set the display BEFORE you call embed_views_exposed_form().', array(), WATCHDOG_ERROR);
    watchdog('embed_views', t('You must set the display BEFORE you call embed_views_exposed_form().'), array(), WATCHDOG_ERROR);
  }
}