You are here

function dlike_form_flag_form_alter in Drupal like (Flag counter) 7.2

Same name and namespace in other branches
  1. 7.3 dlike.module \dlike_form_flag_form_alter()
  2. 7 dlike.module \dlike_form_flag_form_alter()

Implementation of hook_form_form_id_alter().

File

./dlike.module, line 59

Code

function dlike_form_flag_form_alter(&$form, $form_state) {
  $form['dlike-' . $form['#flag']->name . '_option'] = array(
    '#type' => 'checkbox',
    '#title' => 'Add Drupal like',
    '#default_value' => variable_get('dlike-' . $form['#flag']->name . '_option', 0),
    '#weight' => '900',
  );
  $form['dlike-' . $form['#flag']->name . '_text_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Add the text you want to display'),
    '#description' => t('Use <em>@count</em> token for displaying the number of times content has been flagged.<br>e.g. "(@count likes)" or "@count people have flagged this" or "See who all have flagged this content"'),
    '#default_value' => variable_get('dlike-' . $form['#flag']->name . '_text_value', t('(@count)')),
    '#weight' => '901',
  );
  $form['dlike-modal-window-title-' . $form['#flag']->name] = array(
    '#type' => 'textfield',
    '#title' => t('Title for modal window'),
    '#default_value' => variable_get('dlike-modal-window-title-' . $form['#flag']->name, NULL),
    '#description' => t('e.g. "People who like this"'),
    '#weight' => '902',
  );
  $form['dlike-modal-flagged-user-alignment-' . $form['#flag']->name] = array(
    '#type' => 'select',
    '#title' => t('Alignment'),
    '#options' => array(
      'vertical' => 'vertical',
      'horizontal' => 'horizontal',
    ),
    '#default_value' => variable_get('dlike-modal-flagged-user-alignment-' . $form['#flag']->name, NULL),
    '#description' => t('To view flagged user in horizontal/vertical allignment'),
    '#weight' => '903',
  );
  $form['dlike-modal-flagged-user-horizontal-columns-' . $form['#flag']->name] = array(
    '#type' => 'select',
    '#title' => t('select number of columns'),
    '#default_value' => variable_get('dlike-modal-flagged-user-horizontal-columns-' . $form['#flag']->name, NULL),
    '#description' => t('number of columns to be displayed'),
    '#options' => array(
      '2' => '2',
      '3' => '3',
      '4' => '4',
    ),
    '#states' => array(
      'visible' => array(
        ':input[name=dlike-modal-flagged-user-alignment-' . $form['#flag']->name . ']' => array(
          'value' => 'horizontal',
        ),
      ),
    ),
    '#weight' => '904',
  );
  $form['dlike-modal-active-user-flagged-count-' . $form['#flag']->name] = array(
    '#type' => 'checkbox',
    '#title' => t('Show only active users flagged count'),
    '#default_value' => variable_get('dlike-modal-active-user-flagged-count-' . $form['#flag']->name, 0),
    '#description' => t('Show only active users flagged count (By default will display active and blocked user flagged count)'),
    '#weight' => '905',
  );
  $form['#submit'][] = 'dlike_form_data';
}