Commit 561492f6 authored by Neil Hastings's avatar Neil Hastings
Browse files

Change how plugins are loaded. Load classes via the code register

parent 80022e74
Loading
Loading
Loading
Loading
+1 −0
Changes for bean.info: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ files[] = bean.test
files[] = includes/bean.core.inc
files[] = includes/bean.info.inc
files[] = includes/bean.pages.inc
files[] = plugins/base.inc
dependencies[] = block
dependencies[] = entity
dependencies[] = ctools
+8 −0
Changes for bean.install: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -128,3 +128,11 @@ function bean_update_7003() {
    ->execute();
  return t('Bean view mode field added.');
}

/**
 * Update Registry to implement new Code Interface
 */
function bean_update_7004() {
  registry_rebuild();
  return t('Registry has been rebuilt');
}
 No newline at end of file
+6 −5
Changes for bean.module: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -666,12 +666,15 @@ function bean_ctools_plugin_type() {
      'cache' => TRUE,
      'use hooks' => TRUE,
      'classes' => array('handler'),
      'info file' => TRUE,
      'alterable' => TRUE,
      'defaults' => array(
        'label' => t('Block'),
        'cache_level' => DRUPAL_CACHE_PER_ROLE,
        // Editable in the block type UI
        // THESE should have 'bean_custom' as the class
        'editable' => FALSE,
        'view_mode' => 'default',
      ),
    ),
  );
@@ -679,24 +682,22 @@ function bean_ctools_plugin_type() {

/**
 * Implements hook_ctools_plugin_directory().
 */
 *
function bean_ctools_plugin_directory($module, $type) {
  if ($module == 'bean') {
    return 'plugins';
  }
}
}*/

/**
 * Implements hook_bean_types().
 */
function bean_bean_types() {
  $plugins = array();
  $plugin_path = drupal_get_path('module', 'bean') . '/plugins';

  $plugins['bean'] = array(
    'handler' => array(
      'path' => $plugin_path,
      'file' => 'base.inc',
      'file' => 'bean.info',
      'class' => 'bean_plugin',
    ),
  );
+2 −11
Changes for bean_admin_ui/bean_admin_ui.module: 2 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -56,15 +56,6 @@ function bean_admin_ui_menu() {
  return $items;
}

/**
 * Implements hook_ctools_plugin_directory()
 */
function bean_admin_ui_ctools_plugin_directory($module, $type) {
  if ($module == 'bean') {
    return 'plugins';
  }
}

/**
 * Implements hook_bean_types_api_info().
 */
@@ -137,8 +128,8 @@ function _bean_admin_default_plugin() {
    'type' => '',
    'editable' => TRUE,
    'handler' => array(
      'path' => drupal_get_path('module', 'bean_admin_ui') . '/plugins',
      'file' => 'custom.inc',
      'info_file' => TRUE,
      'file' => 'bean_custom.info',
      'class' => 'bean_custom',
      'parent' => 'bean',
    ),
+0 −4
Changes for plugins/base.inc: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -5,10 +5,6 @@
 * Base Plugin Class
 */

if (!interface_exists('bean_type_plugin_interface')) {
  require_once drupal_get_path('module', 'bean') . '/includes/bean.core.inc';
}

abstract class bean_plugin implements bean_type_plugin_interface {
  protected $plugin_info;
  public $type;