You are here

function piwik_stats_field_settings_form in Piwik Statistic Integration 7.2

Implements hook_field_settings_form().

File

./piwik_stats.module, line 197
Integrates piwik statistics as entity fields.

Code

function piwik_stats_field_settings_form($field, $instance, $has_data) {
  $settings = $field['settings'];

  // Add field settings for statistic period.
  $form['period'] = array(
    '#type' => 'select',
    '#title' => t('Period'),
    '#default_value' => $settings['period'],
    '#options' => array(
      'day' => t('Day'),
      'week' => t('Week'),
      'month' => t('Month'),
      'year' => t('Year'),
    ),
    '#required' => TRUE,
    '#description' => t('The period of the requested statistics.'),
  );
  $form['show_in_statistics_page'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show on "Piwik statistics page"'),
    '#default_value' => $settings['show_in_statistics_page'],
    '#description' => t('Show this fields statistics on the "Piwik statistics" page. If no fields are enabled to be shown on the statistics page the page itself will be hidden.'),
  );
  return $form;
}