You are here

function _noderelationships_preprocess_content_field_overview_form in Node Relationships 6

Alter variables used for content-admin-field-overview-form.tpl.php.

1 call to _noderelationships_preprocess_content_field_overview_form()
noderelationships_preprocess_content_field_overview_form in ./noderelationships.module
Alter variables used for content-admin-field-overview-form.tpl.php.

File

./noderelationships.admin.inc, line 761
Implementation of the administration pages of the module.

Code

function _noderelationships_preprocess_content_field_overview_form(&$vars) {

  // Alter row information for back reference fields.
  foreach ($vars['rows'] as $index => $row) {
    if ($row->row_type == 'field' && isset($vars['form'][$row->field_name]['field']['#value'])) {
      $current_field = $vars['form'][$row->field_name]['field']['#value'];
      if (isset($current_field['type']) && $current_field['type'] == 'noderelationships_backref') {
        $type_url_str = str_replace('_', '-', $vars['form']['#type_name']);

        // Use the field type label to display information about the back
        // reference itself.
        if (isset($current_field['referrer_field']) && isset($current_field['referrer_type'])) {
          $referrer_field = content_fields($current_field['referrer_field'], $current_field['referrer_type']);
          $vars['rows'][$index]->type = t('Back references from @referrer-label in @referrer-type', array(
            '@referrer-label' => $referrer_field['widget']['label'],
            '@referrer-type' => noderelationships_get_localized_content_type_name($current_field['referrer_type']),
          ));
        }

        // Use the remove link to point to back reference settings.
        $vars['rows'][$index]->remove = '<br />' . l(t('Back reference settings'), 'admin/content/node-type/' . $type_url_str . '/relationships/backref');
      }
    }
  }
}