function piwik_reports_form_alter in Piwik Reports 7.3
Same name and namespace in other branches
- 6 piwik_reports.module \piwik_reports_form_alter()
- 7.4 piwik_reports.module \piwik_reports_form_alter()
- 7.2 piwik_reports.module \piwik_reports_form_alter()
Implements hook_form_alter().
File
- ./
piwik_reports.module, line 356 - Defines features and functions common to Piwik Reports.
Code
function piwik_reports_form_alter(&$form, $form_state, $form_id) {
// Extend the form in "user/{userid}/edit/account".
if ($form_id == 'user_profile_form' && $form['#user_category'] == 'account' && user_access('access piwik reports') && variable_get('piwik_reports_token_auth', '') == '') {
$account = $form['#user'];
$form['piwik_reports'] = array(
'#type' => 'fieldset',
'#title' => t('Piwik reports configuration'),
'#weight' => 3,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['piwik_reports']['piwik_reports_token_auth'] = array(
'#type' => 'textfield',
'#title' => t('Piwik authentication string'),
'#default_value' => !empty($account->data['piwik_reports_token_auth']) ? $account->data['piwik_reports_token_auth'] : '',
'#size' => 40,
'#maxlength' => 40,
'#description' => t('Click the <strong>Settings</strong> link in your Piwik account, then the <strong>Users</strong> tab and copy and paste your personal <strong>token_auth</strong> value into this field. If anonymous users have view permissions in Piwik, you can set this value to <strong>anonymous</strong> or ask the Piwik server administrator for a token value.'),
);
}
elseif ($form_id == 'piwik_admin_settings_form') {
drupal_set_title(t('Piwik tracking'));
}
}