You are here

function _theme_user_message_select_form in Heartbeat 7

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

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

File

./heartbeat.module, line 1431
Module file for heartbeat activity. Basic hook implementations and helper functions will be found here.

Code

function _theme_user_message_select_form($title, $settings) {
  if (empty($settings)) {
    $settings = array();
  }
  $templates = ctools_export_crud_load_all('heartbeat_messages');
  $options = _heartbeat_perms_options(TRUE);
  $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) {
    $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,
    );
  }
  return $form;
}