You are here

function tinybrowser_role_form in TinyBrowser 7

Role profile form

1 call to tinybrowser_role_form()
tinybrowser_settings_form in ./tinybrowser.module

File

./tinybrowser.module, line 296

Code

function tinybrowser_role_form($role, $weight = TRUE, $core = TRUE) {
  $form['name'] = array(
    '#type' => 'item',
    '#markup' => $role['name'],
  );
  if ($weight) {
    $form['weight'] = $core ? array(
      '#type' => 'textfield',
      '#value' => $role['weight'],
      '#attributes' => array(
        'readonly' => 'readonly',
        'style' => 'border:none; width: 2em; background-color: transparent;',
      ),
    ) : array(
      '#type' => 'weight',
      '#default_value' => $role['weight'],
      '#attributes' => array(
        'class' => 'tinybrowser-weight',
      ),
    );
  }
  $options = array(
    t('none'),
  );
  foreach (variable_get('tinybrowser_profiles', array()) as $pid => $profile) {
    $options[$pid] = $profile['name'];
  }
  $form['pid'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $role['pid'],
  );
  return $form;
}