For some reason ALL my content types are showing a location field. How do I remove the location field from showing. There is no delete field in the manage field tabs and I don't see any way to turn it off in the admin screen. How do I select which content type to show it on?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GilAnder’s picture

HI,
To dismiss the Location field, you have to modify the concerned content type -> Locative information and set the maximum number of locations to 0.
Hope this will help.

js’s picture

I have a location field on unnecessary content types with only these fields

Label: Location
Machine name: locations
Field type: Location module form elements

without widget or operations. So I can't edit the maximum number of locations directly.

I am getting an error from entity.inc
warning: array_flip(): Can only flip STRING and INTEGER values!
which I hope is related.

This problem might be the result of upgrading D6 to D7.

Any help would be appreciated.

vishalgala’s picture

Component: User interface » Fixed in L3
Assigned: Unassigned » vishalgala
legolasbo’s picture

Status: Active » Closed (outdated)

Closing support tickets that have been inactive for over a year to clean up the issue queue. Please reopen if this is still an issue.

smurfxx’s picture

Problem is still here, every new content type has a location field and not editable.
I'm on Drupal 7.50

smurfxx’s picture

Priority: Normal » Critical
smurfxx’s picture

Status: Closed (outdated) » Active
legolasbo’s picture

Priority: Critical » Normal

Critical seems a little over the top for an issue that has been inactive for 2 years.

rooby’s picture

Title: Remove Location field from content types » Location module form elements field present even if location_node is disabled
Version: 7.x-3.3 » 7.x-3.x-dev
Component: Fixed in L3 » Code
Assigned: vishalgala » Unassigned
Category: Support request » Bug report

The location module is adding this with location_field_extra_fields() but it is the location_node module that actually uses it, so if you don't use the location_node module then it is there for nothing.

Seems like location_field_extra_fields() should be in the node_location module instead.

jimmynash’s picture

I had already disabled and uninstalled the location_node module and was still seeing the Locative Information field in the manage fields area of all my content types.

Since there was no implementation of hook_extra_fields in the location_node module I moved the hook from the location module to the location_node module and changed the function name to match it's new home. Cleared the cache and the field no longer shows in the manage fields area.

I then re-enabled the location_node module and the extra field was back provided now by location_node. Disabling location_node then removed the field from the manage fields area.

So, I removed this function from location.module

/**
 * Implements hook_field_extra_fields().
 */
function location_field_extra_fields() {
  $info = array();
  foreach (node_type_get_types() as $node_type) {
    if (!isset($info['node'][$node_type->type]['form']['locations'])) {
      $info['node'][$node_type->type]['form']['locations'] = array(
        'label' => t('Location'),
        'description' => t('Location module form elements'),
        'weight' => 30,
      );
    }
  }

  return $info;
}

and moved it to location_node.module

renaming it to this

/**
 * Implements hook_field_extra_fields().
 */
function location_node_field_extra_fields() {
  $info = array();
  foreach (node_type_get_types() as $node_type) {
    if (!isset($info['node'][$node_type->type]['form']['locations'])) {
      $info['node'][$node_type->type]['form']['locations'] = array(
        'label' => t('Location'),
        'description' => t('Location module form elements'),
        'weight' => 30,
      );
    }
  }

  return $info;
}

This seemed to do the trick for me.

rooby’s picture

@jimmynash:

Yep, that is the solution mentioned in #9

Could you make a patch for that?

dlaufer’s picture

Patch from #10 to move location_field_extra_fields() from location.module to location_node.module so that the Location module form elements field gets removed when disable location_node.

dlaufer’s picture

davemybes’s picture

Status: Needs review » Reviewed & tested by the community

This works great and fixes the small annoyance of having the field always there. Thanks!

TechnoTim2010’s picture

Hi

Installed the patch in #12 and can confirm it works, no bugs to report and can be set as RTBC

Tim