You are here

function rdfui_predicate_fieldset in RDF Extensions 7.2

appends the rdf form fields to a fieldset dedicated to a fields.module field

3 calls to rdfui_predicate_fieldset()
rdfui_admin_rdf_overview_form in rdfui/rdfui.module
Menu callback; listing of field RDF mappings for a content type.
rdfui_form_field_ui_field_edit_form_alter in rdfui/rdfui.module
Implements hook_form_FORM_ID_alter().
rdfui_form_node_type_form_alter in rdfui/rdfui.module
Implements hook_form_FORM_ID_alter().

File

rdfui/rdfui.module, line 426

Code

function rdfui_predicate_fieldset(&$fieldset, $mapping, $field_name, $label) {
  $fieldset['rdf_' . $field_name . '_predicates'] = array(
    '#type' => 'textfield',
    '#autocomplete_path' => 'rdfui/predicates/autocomplete',
    '#title' => t('RDF Predicates'),
    '#default_value' => empty($mapping[$field_name]['predicates']) ? '' : implode(", ", $mapping[$field_name]['predicates']),
    '#description' => t('Enter a comma-separated list of predicates for %label using CURIE syntax. For example: %predicates', array(
      '%label' => $label,
      '%predicates' => 'foaf:familyName, foaf:lastName',
    )),
    '#resizable' => FALSE,
  );
  $fieldset['rdf_' . $field_name . '_type'] = array(
    '#type' => 'select',
    '#title' => t('Attribute Type'),
    '#default_value' => empty($mapping[$field_name]['type']) ? 'property' : $mapping[$field_name]['type'],
    '#description' => t('For fields containing literals—things such as plain text, html, numbers—use the !property attribute. For fields containing references to other things—urls and node references, for example—use the !rel or !rev attribute.', array(
      '%label' => $label,
      '!property' => l('property', 'http://www.w3.org/2006/07/SWD/RDFa/syntax/#id103203'),
      '!rel' => l('rel', 'http://www.w3.org/2006/07/SWD/RDFa/syntax/#id103235'),
      '!rev' => l('rev', 'http://www.w3.org/2006/07/SWD/RDFa/syntax/#id103282'),
    )),
    '#options' => array(
      'property' => 'property',
      'rel' => 'rel',
      'rev' => 'rev',
    ),
    '#attributes' => array(
      'class' => array(
        'rdf-attribute-type',
      ),
    ),
  );

  // @todo Possibly autocomplete the builtin xsd datatypes, but do not restrict to xsd datatypes.
  $fieldset['rdf_' . $field_name . '_datatype'] = array(
    '#type' => 'textfield',
    '#title' => t('Datatype'),
    '#autocomplete_path' => 'rdfui/datatype/autocomplete',
    '#default_value' => empty($mapping[$field_name]['datatype']) ? '' : $mapping[$field_name]['datatype'],
    '#description' => t('Enter the datatype for %label using CURIE syntax. For a list of common datatypes, see !link.', array(
      '%label' => $label,
      '!link' => l('XML Schema datatypes', 'http://www.w3.org/TR/2004/REC-rdf-mt-20040210/#dtype_interp', array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
    )),
    '#states' => array(
      'visible' => array(
        ':input[name="rdf_' . $field_name . '_type"]' => array(
          'value' => 'property',
        ),
      ),
    ),
  );
  drupal_add_css(drupal_get_path('module', 'rdfui') . '/css/rdfui.css', 'file');
}