You are here

class MenuBeanType in Menu Bean 7

Hierarchy

Expanded class hierarchy of MenuBeanType

1 string reference to 'MenuBeanType'
menu_bean_bean_types in ./menu_bean.module
Implements hook_bean_types().

File

plugins/MenuBeanType.class.php, line 3

View source
class MenuBeanType extends BeanPlugin {
  public function values() {
    $settings = menu_bean_get_settings();
    $values = array(
      'menu_name' => 'main-menu',
    );
    foreach ($settings as $key => $info) {
      $values = array_merge_recursive($values, $info['default_values']);
    }
    return $values + parent::values();
  }
  public function form($bean, $form, &$form_state) {
    $menus = menu_get_menus();
    $form['menu_name'] = array(
      '#type' => 'select',
      '#title' => t('Menu'),
      '#default_value' => $bean->menu_name,
      '#options' => $menus,
    );
    $settings = menu_bean_get_settings();
    foreach ($settings as $key => $class) {
      menu_bean_load_setting_class($key)
        ->form($bean, $form, $form_state);
    }
    return $form;
  }
  public function view($bean, $content, $view_mode = 'default', $langcode = NULL) {
    $altertree = array();
    $tree = menu_bean_load_setting_class(menu_bean_get_initial_plugin_key())
      ->alterTree($altertree, $bean);
    $settings = menu_bean_get_settings();
    foreach ($settings as $key => $class) {
      menu_bean_load_setting_class($key)
        ->alterTree($tree, $bean);
    }
    return menu_tree_output($tree);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BeanPlugin::$plugin_info protected property
BeanPlugin::$type public property
BeanPlugin::buildURL public function Build the URL string Overrides BeanTypePluginInterface::buildURL
BeanPlugin::getDescription public function Get the description Overrides BeanTypePluginInterface::getDescription
BeanPlugin::getInfo public function Get Plugin info Overrides BeanTypePluginInterface::getInfo
BeanPlugin::getLabel public function Get the label Overrides BeanTypePluginInterface::getLabel
BeanPlugin::isEditable public function Is the bean type editable Overrides BeanTypePluginInterface::isEditable
BeanPlugin::setBean public function Add a Bean to the plugin Overrides BeanTypePluginInterface::setBean
BeanPlugin::submit public function React to the saving of the bean Overrides BeanTypePluginInterface::submit
BeanPlugin::validate public function THe plugin validation function Overrides BeanTypePluginInterface::validate
BeanPlugin::__construct public function Constructor Overrides BeanTypePluginInterface::__construct
MenuBeanType::form public function The Plugin Form Overrides BeanPlugin::form
MenuBeanType::values public function Define the form values and their defaults Overrides BeanPlugin::values
MenuBeanType::view public function Return the block content. Overrides BeanPlugin::view