You are here

function schemaorg_ui_form_node_type_form_alter in Schema.org 7

Implements hook_form_FORM_ID_alter().

File

modules/schemaorg_ui/schemaorg_ui.module, line 11
User interface for setting the schema.org mappings

Code

function schemaorg_ui_form_node_type_form_alter(&$form, $form_state) {
  if (isset($form['type'])) {
    $bundle = $form['#node_type']->type;
    $form['schemaorg_ui'] = array(
      '#type' => 'fieldset',
      '#title' => t('Schema.org settings'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'additional_settings',
    );
    $form['schemaorg_ui']['schemaorg_ui_type'] = array(
      '#type' => 'textfield',
      '#title' => t('Type'),
      '#description' => t('Specify the type you want to associated to this content type e.g. Article, Blog, etc.'),
      '#default_value' => schemaorg_ui_term_load('node', $bundle, 'rdftype'),
      '#attributes' => array(
        'class' => array(
          'schemaorg-ui-autocomplete-types',
        ),
      ),
    );
    $form['#submit'][] = 'schemaorg_ui_node_type_form_submit';

    // Use jQuery UI autocomplete to provide a faster autocomplete without
    // callback to the server.
    $form['#attached']['library'][] = array(
      'system',
      'ui.autocomplete',
    );
    $form['#attached']['css'][] = drupal_get_path('module', 'schemaorg_ui') . '/css/schemaorg_ui.jquery.ui.theme.css';
    $form['#attached']['js'][] = drupal_get_path('module', 'schemaorg_ui') . '/js/schemaorg_ui.js';
    $form['#attached']['js'][] = array(
      'data' => array(
        'schemaorguiapiTermsPath' => base_path() . drupal_get_path('module', 'schemaorg_ui') . '/js/schemaorg_ui.terms.json',
      ),
      'type' => 'setting',
    );
  }
}