2

I had build plugin type Bean which used ajax load more form . But this not working ? How to fix or change my code . This file Class extends BeanPlugin

 class IconLinkSocial extends BeanPlugin {

  public function values()
  {
    $values = array(
      'link_icon' => array(
        'font_icon' => '',
        'link_text' => '',
      )
    );
    return array_merge(parent::values(),$values);
  }

  /**
   *  Build extra settings for the block edit form
   */
  public function form($bean,$form,&$form_state)
  {
    $form = array();

    $form['link_icon'] = array(
      '#type' => 'fieldset',
      '#tree' => 1,
      '#title' => t('Icon Link'),
      '#prefix' => '',
      '#suffix' => '',
    );
     if (empty($form_state['num_items'])) {
      $form_state['num_items'] = 1;
    }
     for ($i = 0; $i  'textfield',
        '#title' => t('Icon'),
        '#description' => t('Input name icon font Autoload ,support font Awesome'),
        '#default_value' => isset($bean->link_icon['font_icon'][$i]) ? $bean->link_icon['font_icon'][$i] : ''
      );
      $form['link_icon']['link'][$i] = array(
        '#type' => 'textfield',
        '#title' => t('Link'),
        '#description' => t('Link for icon'),
        '#default_value' => isset($bean->link_icon['link'][$i]) ? $bean->link_icon['link'][$i] :''
        );
    }
    $form['add_more_button'] = array(
      '#type' => 'submit',
      '#value' => t('Add one more'),
      '#submit' => array('icon_link_add_more_add_one'),
      // See the examples in ajax_example.module for more details on the
      // properties of #ajax.
      '#ajax' => array(
        'callback' => 'icon_link_ajax_add_more_callback',
        'wrapper' => 'fieldset-link-icon',
      ),
    );
    return $form;
  }


  public function icon_link_add_more_add_one($form, &$form_state) {

    $form_state['num_items']++;
    $form_state['rebuild'] = TRUE;

  }

  public function icon_link_ajax_add_more_callback($form, $form_state) {
    return $form['link_icon'];
  }

  /*
   * Display The bean Icon Link Social plugin
   */
  public function view($bean,$content,$view_mode = 'default',$langcode=NULL)
  {
    return 'Debug';
  }
}

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.