1 block.overview_content.inc DashboardOverviewContentBlock::form(&$form, &$form_state)

Build the settings form for editing this block.

Overrides Block::form

File

core/modules/dashboard/includes/block.overview_content.inc, line 123
Dashboard block displaying information about content, including:

Class

DashboardOverviewContentBlock
@file Dashboard block displaying information about content, including:

Code

function form(&$form, &$form_state) {
  parent::form($form, $form_state);
  $settings = $this->settings;

  $node_types = node_type_get_types();
  $options = array();
  foreach ($node_types as $machine_name => $node_type) {
    $options[$machine_name] = check_plain(t($node_type->name));
  }

  $form['types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Display <strong>post</strong> counts for the following content types'),
    '#options' => $options,
    '#default_value' => empty($settings['types']) ? array_keys($options) : $settings['types'],
  );

  if (module_exists('comment')) {
    $form['comment'] = array(
      '#type' => 'fieldset',
      '#title' => t('Comment counts'),
      '#tree' => FALSE,
      '#collapsible' => TRUE,
    );
    $form['comment']['comment_enabled'] = array(
      '#type' => 'checkbox',
      '#title' => t('Display comment counts'),
      '#default_value' => $settings['comment_enabled'],
    );
    $form['comment']['comment_include_unapproved'] = array(
      '#type' => 'checkbox',
      '#title' => t('Include unapproved comments in comment counts'),
      '#default_value' => $settings['comment_include_unapproved'],
      '#states' => array(
        'visible' => array(
          '[name="comment_enabled"]' => array('checked' => TRUE),
        ),
      ),
    );
    $form['comment']['comment_types'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Display <strong>comment</strong> counts for the following content types'),
      '#options' => $options,
      '#default_value' => empty($settings['comment_types']) ? array_keys($options) : $settings['comment_types'],
      '#states' => array(
        'visible' => array(
          '[name="comment_enabled"]' => array('checked' => TRUE),
        ),
      ),
    );
  }
}