Commit 089d5865 authored by Neil Hastings's avatar Neil Hastings
Browse files

Issue #1340338 by duellj and indytechcook: Fixed Notice if editing bean...

Issue #1340338 by duellj and indytechcook: Fixed Notice if editing bean without access to change view mode.
parent 2c1c065c
Loading
Loading
Loading
Loading
+0 −12
Changes for bean_admin_ui/plugins/custom.inc: 0 added lines, 12 removed lines.
Original line number Diff line number Diff line
@@ -55,16 +55,4 @@ class bean_custom extends bean_plugin {
  public function setLabel($label) {
    $this->plugin_info['label'] = $label;
  }

  public function values() {
    return array();
  }

  public function form($bean) {
    return array();
  }

  public function view($bean, $content, $view_mode = 'default', $langcode = NULL, $page = NULL) {
    return $content;
  }
}
+6 −0
Changes for includes/bean.pages.inc: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -199,6 +199,12 @@ function bean_form($form, &$form_state, $bean, $type = NULL) {
      '#weight' => -8,
    );
  }
  else {
    $form['view_mode'] = array(
      '#type' => 'value',
      '#value' => $bean->view_mode,
    );
  }

  $form['bean'] = array(
    '#type' => 'value',
+15 −15
Changes for plugins/base.inc: 15 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -43,6 +43,21 @@ abstract class bean_plugin implements bean_type_plugin_interface {
    $this->type = $plugin_info['name'];
  }

  /**
   * Define the form values and their defaults
   *
   * Be sure to call combine the results form the parent::values() with yours
   */
  public function values() {
    return array(
      'view_mode' => 'default',
    );
  }

  public function form($bean) {
    return array();
  }

  /**
   * Add a Bean to the plugin
   */
@@ -75,21 +90,6 @@ abstract class bean_plugin implements bean_type_plugin_interface {
   * @return
   *   Return a renderable content array.
   */
  public function view($bean, $content, $view_mode = 'default', $langcode = NULL) {}
}

/**
 * Example Implementation
 */
class bean_default extends bean_plugin {
  public function values() {
    return array();
  }

  public function form($bean) {
    return array();
  }

  public function view($bean, $content, $view_mode = 'default', $langcode = NULL) {
    return $content;
  }