'fieldset', '#title' => t('diggthis settings') ); $form['diggthis']['diggthis_button_skin'] = array( '#type' => 'select', '#title' => t('Button skin'), '#default_value' => variable_get('diggthis_button_skin', 'Medium'), '#options' => array( 'Medium' => t('medium'), 'Large' => t('large'), 'Compact' => t('compact'), 'Icon' => t('icon') ), '#description' => t('The Button skin option controls the look at the button. If set to standard the button defaults to a standard digg button (much like the one you see on Digg itself). If specified as compact, then a smaller horizontal visual design is used that will fit better into a list of links.'), '#attributes' => array('class' => 'diggthis_update_preview') ); $form['diggthis']['diggthis_type'] = array( '#type' => 'select', '#title' => t('Digg media type'), '#default_value' => variable_get('diggthis_type', ''), '#options' => diggthis_select_options(array('news', 'image', 'video'), t('Select type')), '#description' => t("Pre select a media type for your site's content. Leave unselected to not set a media type."), '#attributes' => array('class' => 'diggthis_update_preview') ); $form['diggthis']['diggthis_topic'] = array( '#type' => 'select', '#title' => t('Digg topic'), '#default_value' => variable_get('diggthis_topic', ''), '#options' => diggthis_select_options($topics, t('Select topic')), '#description' => t("Pre select a topic for your site's content. Leave unselected to not set a topic."), '#attributes' => array('class' => 'diggthis_update_preview') ); $form['diggthis']['diggthis_button_weight'] = array( '#type' => 'select', '#title' => t('Weight'), '#default_value' => variable_get('diggthis_button_weight', 10), '#options' => drupal_map_assoc(range(-20, 20)), '#description' => t('Specifies the position of the Diggthis button. A low weight, e.g. -20 will display the button above the content and a high weight, e.g. 20 below the content.') ); $form['diggthis']['diggthis_node_types'] = array( '#type' => 'checkboxes', '#title' => t('Node Types'), '#default_value' => variable_get('diggthis_node_types', array()), '#options' => node_get_types('names'), '#description' => t('activate the node types in where the digg button shall be displayed') ); $form['diggthis_api'] = array( '#type' => 'fieldset', '#title' => t('diggthis API settings') ); $form['diggthis_api']['diggthis_stories_domain'] = array( '#type' => 'textfield', '#title' => t('Digg Stories Domain'), '#default_value' => variable_get('diggthis_stories_domain', ''), '#size' => 32, '#maxlength' => 128, '#description' => t('Enter the domain, e.g. mydomain.com, that will be used to show top Digg stories for.') ); $period = drupal_map_assoc(array(21600, 43200, 86400), 'format_interval'); $form['diggthis_api']['diggthis_cache_lifetime'] = array( '#type' => 'select', '#title' => t('Minimum cache lifetime'), '#default_value' => variable_get('diggthis_cache_lifetime', 43200), '#options' => $period, '#description' => t('The time the response from the Digg API is cached before being requested again.') ); $button = diggthis_button_create(); $form['diggthis']['preview'] = array( '#value' => '
', ); return system_settings_form($form); } function diggthis_select_options($options, $unselected) { $select[''] = $unselected; foreach ($options as $option) { $select[$option] = str_replace('_', ' ', $option); } return $select; }