You are here

function socialfield_edit_service in Social field 7

Form for editing a service.

1 string reference to 'socialfield_edit_service'
socialfield_menu in ./socialfield.module
Implements hook_menu().

File

./socialfield.module, line 168
Provides a field for adding social services links.

Code

function socialfield_edit_service($form, $form_state, $service = NULL) {
  if (!isset($service)) {
    drupal_set_message(t('No service specified.'), 'error');
    drupal_goto('admin/config/media/socialfield');
  }
  $services = variable_get('socialfield_services');
  if (!isset($services[$service])) {
    drupal_set_message(t('The specified service does not exist.'), 'error');
    drupal_goto('admin/config/media/socialfield');
  }
  $form['service'] = array(
    '#type' => 'textfield',
    '#title' => t('Service machine name'),
    '#value' => $service,
    '#disabled' => TRUE,
  );
  $form['service_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Service name'),
    '#default_value' => $services[$service]['name'],
  );
  $form['service_icon'] = array(
    '#type' => 'textfield',
    '#description' => t('Example: icon-facebook'),
    '#title' => t('Service fonticon class'),
    '#default_value' => $services[$service]['icon'],
  );
  $form['service_validation_pattern'] = array(
    '#type' => 'textarea',
    '#description' => t('Enter the list of allowed urls separated by new line.<br />Leave empty to allow user input any urls.<br />The "*" character is a wildcard.<br />Example: *facebook.com/* for any page on Facebook site.'),
    '#title' => t('Url validation pattern'),
    '#default_value' => $services[$service]['validation_pattern'],
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}