| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 | <?phpclass tripal_views_handler_area_action_links extends views_handler_area {  function option_definition() {    $options = parent::option_definition();    $options['link-1']['label-1'] = array('default' => '');    $options['link-1']['path-1'] = array('default' => '');    $options['link-2']['label-2'] = array('default' => '');    $options['link-2']['path-2'] = array('default' => '');    $options['link-3']['label-3'] = array('default' => '');    $options['link-3']['path-3'] = array('default' => '');    $options['link-4']['label-4'] = array('default' => '');    $options['link-4']['path-4'] = array('default' => '');    return $options;  }  function options_form(&$form, &$form_state) {    parent::options_form($form, $form_state);    $form['label']['#default_value'] = 'Action Links';    $form['link-1'] = array(      '#type' => 'fieldset',      '#title' => t('Link #1')    );    $form['link-1']['label-1'] = array(      '#type' => 'textfield',      '#title' => t('Label'),      '#description' => t('The text that will be displayed as the link'),      '#default_value' => $this->options['link-1']['label-1'],    );    $form['link-1']['path-1'] = array(      '#type' => 'textfield',      '#title' => t('URL'),      '#description' => t('The path that the link will link to'),      '#default_value' => $this->options['link-1']['path-1']    );    $form['link-2'] = array(      '#type' => 'fieldset',      '#title' => t('Link #2')    );    $form['link-2']['label-2'] = array(      '#type' => 'textfield',      '#title' => t('Label'),      '#description' => t('The text that will be displayed as the link'),      '#default_value' => $this->options['link-2']['label-2'],    );    $form['link-2']['path-2'] = array(      '#type' => 'textfield',      '#title' => t('URL'),      '#description' => t('The path that the link will link to'),      '#default_value' => $this->options['link-2']['path-2']    );    $form['link-3'] = array(      '#type' => 'fieldset',      '#title' => t('Link #3')    );    $form['link-3']['label-3'] = array(      '#type' => 'textfield',      '#title' => t('Label'),      '#description' => t('The text that will be displayed as the link'),      '#default_value' => $this->options['link-3']['label-3'],    );    $form['link-3']['path-3'] = array(      '#type' => 'textfield',      '#title' => t('URL'),      '#description' => t('The path that the link will link to'),      '#default_value' => $this->options['link-3']['path-3']    );    $form['link-4'] = array(      '#type' => 'fieldset',      '#title' => t('Link #4')    );    $form['link-4']['label-4'] = array(      '#type' => 'textfield',      '#title' => t('Label'),      '#description' => t('The text that will be displayed as the link'),      '#default_value' => $this->options['link-4']['label-4'],    );    $form['link-4']['path-4'] = array(      '#type' => 'textfield',      '#title' => t('URL'),      '#description' => t('The path that the link will link to'),      '#default_value' => $this->options['link-4']['path-4']    );  }  function options_submit(&$form, &$form_state) {    parent::options_submit($form, $form_state);    ddl($form_state, 'form state in submit');    $this->options['link-1']['label-1'] = $form_state['values']['options']['link-1']['label-1'];    $this->options['link-1']['path-1'] = $form_state['values']['options']['link-1']['path-1'];    $this->options['link-2']['label-2'] = $form_state['values']['options']['link-2']['label-2'];    $this->options['link-2']['path-2'] = $form_state['values']['options']['link-2']['path-2'];    $this->options['link-3']['label-3'] = $form_state['values']['options']['link-3']['label-3'];    $this->options['link-3']['path-3'] = $form_state['values']['options']['link-3']['path-3'];    $this->options['link-4']['label-4'] = $form_state['values']['options']['link-4']['label-4'];    $this->options['link-4']['path-4'] = $form_state['values']['options']['link-4']['path-4'];  }  function render($empty = FALSE) {    if (!$empty || !empty($this->options['empty'])) {      $output = '<ul class="action-links">';      // First link      if (!empty($this->options['link-1']['label-1']) AND !empty($this->options['link-1']['path-1'])) {        $output .= '<li>' . l($this->options['link-1']['label-1'], $this->options['link-1']['path-1']) . '</li>';      }      // Second link      if (!empty($this->options['link-2']['label-2']) AND !empty($this->options['link-2']['path-2'])) {        $output .= '<li>' . l($this->options['link-2']['label-2'], $this->options['link-2']['path-2']) . '</li>';      }      // Third link      if (!empty($this->options['link-3']['label-3']) AND !empty($this->options['link-3']['path-3'])) {        $output .= '<li>' . l($this->options['link-3']['label-3'], $this->options['link-3']['path-3']) . '</li>';      }      // Fourth link      if (!empty($this->options['link-4']['label-4']) AND !empty($this->options['link-4']['path-4'])) {        $output .= '<li>' . l($this->options['link-4']['label-4'], $this->options['link-4']['path-4']) . '</li>';      }      $output .= '</ul>';      return $output;    }    return '';  }}
 |