You are here

function subscriptions_type_form in Subscriptions 5

1 string reference to 'subscriptions_type_form'
subscriptions_type in ./subscriptions.module

File

./subscriptions.module, line 1290

Code

function subscriptions_type_form($tree, $account, $types) {
  foreach ($tree as $ntype => $nname) {
    $defval = in_array($ntype, $types) ? 1 : 0;
    $orgstate[] = array(
      0,
      $account->uid,
      'type' . $ntype,
      $defval,
    );
    $subsrows['subform']['substype' . $ntype] = array(
      '#type' => 'checkbox',
      '#title' => $nname->name,
      '#default_value' => $defval,
    );
  }
  if (empty($tree)) {
    $subsrows['subform'] = array(
      '#value' => t('There are no active content types.'),
    );
  }
  else {
    $subsrows['orgstate'] = array(
      '#type' => 'hidden',
      '#value' => serialize($orgstate),
    );
    $subsrows['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  return $subsrows;
}