The hook name and the implementation need to be updated to return an extra field for every content type for which the inline widget is enabled. Patch to follow shortly.

The symptom is that you cannot order the position of the uniqueness widget in in 7.x-1.x-dev.

Comments

danchadwick’s picture

Status: Active » Needs review
StatusFileSize
new1.7 KB

Port of hook_content/field_extra_fields ready for review.

/**
 * Implements hook_field_extra_fields().
 *
 * Allows the inline uniqueness field to be sorted on the manage fields page for
 * any content type for which it is enabled.
 */
function uniqueness_field_extra_fields() {
  $extras = array();
  if (in_array(UNIQUENESS_WIDGET_INLINE, variable_get('uniqueness_widgets', array(UNIQUENESS_WIDGET_INLINE)))) {
    // The inline widget is enabled
    foreach (array_keys(node_type_get_types()) as $type) {
      $v = variable_get('uniqueness_type_' . $type, array());
      if (!empty($v)) {
        $extras['node'][$type] = array(
          'form' => array(
            'uniqueness' => array(
              'label' => filter_xss_admin(variable_get('uniqueness_default_title', t('Related content'))),
              'description' => t('Uniqueness inline widget.'),
              'weight' => 0,
            ),
          ),
        );
      }
    }
  }

  return $extras;
}
bforchhammer’s picture

Status: Needs review » Fixed

Thanks. Committed and pushed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

typo