You are here

function blockreference_field_formatter_settings_form in Block reference 7.2

Implements hook_field_formatter_settings_form().

File

./blockreference.field.inc, line 130

Code

function blockreference_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  $element = array();
  if ($display['type'] == 'blockreference_config_link') {
    $element['label'] = array(
      '#type' => 'select',
      '#title' => t('Label'),
      '#options' => drupal_map_assoc(array(
        'default',
        'custom',
        'info',
        'config',
        'rendered',
      )),
      '#default_value' => $settings['label'],
      '#attributes' => array(
        'class' => array(
          'blockreference-label-type',
        ),
      ),
    );
    $element['custom_label'] = array(
      '#type' => 'textfield',
      '#title' => t('Custom label'),
      '#default_value' => $settings['custom_label'],
      '#description' => t('If empty, the default will be used: "configure block"'),
      '#states' => array(
        'visible' => array(
          'select.blockreference-label-type' => array(
            'value' => 'custom',
          ),
        ),
      ),
    );
    $element['destination'] = array(
      '#type' => 'checkbox',
      '#title' => t('Remember location?'),
      '#default_value' => $settings['destination'],
      '#description' => t('If checked, will append a ?destination to the URL, to come back after saving.'),
    );
    return $element;
  }
  if (isset($settings['show_empty_blocks'])) {
    $element['show_empty_blocks'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show empty blocks?'),
      '#default_value' => $settings['show_empty_blocks'],
      '#description' => t("Hiding empty blocks (usually a good thing) will move up the rendering process and check its output. If the render moment is important, don't do this."),
    );
    return $element;
  }
}