You are here

function structured_data_local_form in Structured Data (JSON+LD Rich Snippets) 7

Fieldset builder for the Local Business settings form.

1 call to structured_data_local_form()
structured_data_settings_form in ./structured_data.admin.inc
Form callback for admin settings page.

File

./structured_data.admin.inc, line 155
Administrative pages for the structured_data module.

Code

function structured_data_local_form(&$form_state) {
  $fieldset = array(
    '#type' => 'fieldset',
    '#title' => t('Local business details'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $fieldset['structured_data_business_type'] = array(
    '#type' => 'select',
    '#title' => t('Type of business'),
    '#options' => array(
      'Organization' => 'Organization',
      'Airline' => 'Airline',
      'Corporation' => 'Corporation',
      'GeneralContractor' => 'General Contractor',
      'EducationalOrganization' => 'Educational Organization',
      'GovernmentOrganization' => 'Government Organization',
      'LocalBusiness' => 'Local Business',
      'MedicalOrganization' => 'Medical Organization',
      'NGO' => 'NGO',
      'PerformingGroup' => 'Performing Group',
      'SportsOrganization' => 'Sports Organization',
    ),
    '#empty_option' => t('- None -'),
    '#default_value' => variable_get('structured_data_business_type', 'Organization'),
  );

  // Address fields.
  $fieldset['structured_data_address'] = array(
    '#type' => 'textfield',
    '#title' => t('Address'),
    '#size' => 120,
    '#default_value' => variable_get('structured_data_address', ''),
  );
  $fieldset['structured_data_city'] = array(
    '#type' => 'textfield',
    '#title' => t('City'),
    '#default_value' => variable_get('structured_data_city', ''),
  );
  $fieldset['structured_data_state'] = array(
    '#type' => 'textfield',
    '#title' => t('State'),
    '#default_value' => variable_get('structured_data_state', ''),
  );
  $fieldset['structured_data_zip'] = array(
    '#type' => 'textfield',
    '#title' => t('Zip'),
    '#default_value' => variable_get('structured_data_zip', ''),
  );
  if (variable_get('structured_data_business_type', '') != '' || variable_get('structured_data_address', '') != '' || variable_get('structured_data_city', '') != '' || variable_get('structured_data_state', '') != '' || variable_get('structured_data_zip', '') != '') {
    if (variable_get('structured_data_business_type', '') != 'Organization') {
      $fieldset['#collapsed'] = FALSE;
    }
  }
  return $fieldset;
}