Commit 8af1ab44 authored by Neil Hastings's avatar Neil Hastings
Browse files

Issue #1351694 by indytechcook: Check if bean type class exists when loading bean.

parent 02b18513
Loading
Loading
Loading
Loading
+8 −0
Changes for bean.install: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -147,3 +147,11 @@ function bean_update_7005() {
  menu_rebuild();
  return t('Registry and Menu have been rebuilt');
}

/**
 * Rebuild the registry to include new translation class
 */
function bean_update_7006() {
  registry_rebuild();
  return t('Registry and Menu have been rebuilt');
}
 No newline at end of file
+8 −2
Changes for bean.module: 8 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ function bean_load_delta($delta, $reset = FALSE) {
}

/**
 * Menu callbac to load a bean by the delta
 * Menu callback to load a bean by the delta
 */
function bean_delta_load($delta) {
  return bean_load_delta($delta);
@@ -710,11 +710,17 @@ function bean_bean_types() {

  $plugins['bean'] = array(
    'handler' => array(
      'file' => 'bean.info',
      'class' => 'bean_plugin',
    ),
  );

  $plugins['bean_default'] = array(
    'handler' => array(
      'class' => 'bean_default',
      'parent' => 'bean',
    ),
  );

  return $plugins;
}

+7 −1
Changes for includes/bean.core.inc: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -157,8 +157,14 @@ class Bean extends Entity {
   * This is a work around for version of PDO that call __construct() before
   * it loads up the object with values from the DB.
   */
  public function loadUp(bean_type_plugin_interface $plugin) {
  public function loadUp($plugin) {
    if (empty($this->plugin)) {
      // If the plugin has been disabled, the $plugin will be a boolean.
      // just load the base plugin so something will render
      if (!($plugin instanceof bean_type_plugin_interface)) {
        $plugin = bean_load_plugin_class('bean_default');
      }

      $this->setPlugin($plugin);
      $this->setFields();
    }
+2 −0
Changes for plugins/base.inc: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -90,3 +90,5 @@ abstract class bean_plugin implements bean_type_plugin_interface {
    return $content;
  }
}

class bean_default extends bean_plugin {}