You are here

function _theme_user_message_select_form in Heartbeat 6.4

Same name and namespace in other branches
  1. 7 heartbeat.module \_theme_user_message_select_form()

Helper theme function for the activity selection in the user profile form

1 call to _theme_user_message_select_form()
heartbeat_user in ./heartbeat.module
Implementation of hook_user().

File

./heartbeat.module, line 1002

Code

function _theme_user_message_select_form($title, $settings) {
  if (empty($settings)) {
    $settings = array();
  }
  $templates = heartbeat_messages('all', FALSE, TRUE);
  $options = _heartbeat_perms_options(TRUE);
  $allowed_templates = variable_get('heartbeat_profile_message_templates', array());
  if (empty($allowed_templates)) {
    return array();
  }
  $form['heartbeat_activity_settings'] = array(
    '#type' => 'fieldset',
    '#title' => $title,
    '#weight' => 4,
    '#tree' => TRUE,
    '#collapsible' => TRUE,
    '#description' => t('This setting lets you configure the visibility of activity messages.'),
    '#theme' => 'heartbeat_message_user_select_form',
  );
  foreach ($templates as $template) {
    if (!isset($allowed_templates[$template->message_id])) {
      continue;
    }
    $form['heartbeat_activity_settings'][$template->message_id]['title'] = array(
      '#value' => !empty($template->description) ? $template->description : str_replace('_', ' ', $template->message_id),
    );
    $form['heartbeat_activity_settings'][$template->message_id]['access'] = array(
      '#type' => 'select',
      '#options' => $options,
      '#default_value' => isset($settings[$template->message_id]['access']) ? $settings[$template->message_id]['access'] : HEARTBEAT_PUBLIC_TO_ALL,
    );
  }
  ksort($form['heartbeat_activity_settings']);
  return $form;
}