You are here

function theme_rdfx_mapping_admin_overview_row in RDF Extensions 7.2

Theme function to output a field's row in the bundle mapping table.

1 theme call to theme_rdfx_mapping_admin_overview_row()
theme_rdfx_mapping_admin_overview in ./rdfx.admin.inc
Theme function to output the table for a bundle's mappings.

File

./rdfx.admin.inc, line 125

Code

function theme_rdfx_mapping_admin_overview_row($variables) {
  $field = $variables['field'];
  $field_label = '<strong>' . t($field['label']) . '</strong>';
  $predicates = isset($field['rdf_mapping']['predicates']) ? t(implode(', ', $field['rdf_mapping']['predicates'])) : '';
  $predicate_type = isset($field['rdf_mapping']['type']) ? check_plain($field['rdf_mapping']['type']) : 'property';
  $datatype = isset($field['rdf_mapping']['datatype']) ? $field['rdf_mapping']['datatype'] : '';
  $row = array(
    $field_label,
    $predicates,
    $predicate_type,
    $datatype,
  );

  // Add operations links only if RDF UI is enabled.
  if (module_exists('rdfui')) {
    $operations = '';
    if (isset($variables['edit_path'])) {

      // By adding the appropriate url fragment, we can open the corresponding
      // vertical tab on the RDF mapping UI page. The fragment should correspond
      // to the html id for each fieldset, which means certain characters need
      // to be replaced. These replacement patterns are from drupal_html_id().
      $id = $variables['field_name'] == 'title' ? 'rdf-title' : $variables['field_name'];
      $id = strtr(drupal_strtolower($id), array(
        ' ' => '-',
        '_' => '-',
        '[' => '-',
        ']' => '',
      ));
      $id = preg_replace('/[^A-Za-z0-9\\-_]/', '', $id);
      $id = preg_replace('/\\-+/', '-', $id);
      $operations = l(t('edit'), $variables['edit_path'], array(
        'fragment' => "edit-{$id}",
      ));
    }
    $row[] = $operations;
  }
  return $row;
}