The position of location in the create contents pages for types that have locations is fixed at the bottom. I would like it to be more prominent on the page, but there is no way to move it up.

CommentFileSizeAuthor
#10 loc_node.patch2.2 KBderhasi
#1 Picture 1.JPG37.66 KBlyricnz

Comments

lyricnz’s picture

Status: Active » Fixed
StatusFileSize
new37.66 KB

This position is already configurable on each place that the Location fields are placed (on content-type edit page, or user-settings page). See attached screenshot for example. If you can't see this, you might want to try the -dev release - a number of changes have gone in since RC2.

mikel1’s picture

Oops! I expected it to be on the "manage fields" page, where I can change the order of other fields. I didn't think to look for it on the content type edit page. Thanks for pointing this out.

mikel1’s picture

Status: Fixed » Active

Actually, without it being on the manage fields page I can't put the location wherever I want. Weight -3 puts it too high, -2 too low. The issue is the rest of the fields are manager by drag and drop, rather than setting an absolute number. So my original feature request stands - to move location via manage fields...

patchak’s picture

I agree as this seems to be the only difference between normal node location and the cck field??

Patchak

bdragon’s picture

Execution order, maybe?

What happens if you give location a negative weight in the system table?

mikel1’s picture

Not sure I understand the question. It is set to -2 now, and appears one item below where I would like to put it. I'm guessing that the "drag and drop" order puts consecutive numbers in the table, and it's sorting alphabetically or by some other criteria.

patchak’s picture

I managed to place it approximately where I want it with the weight, but I think it would be more useful to concentrate on the features of the cck field so that then people can really use the power of cck combined with this?? As far as I can see this is one of the only differences between the two ways to set up locations module ??

jefftrnr’s picture

I have the same problem. It would be MUCH easier for me to manage the Location weight in relationship to all of the other CCK and core fields on the "Manage Fields" page.

I tried adding this code to the content_content_extra_fields hook function. The "Location Module" form group is displayed in the drag/drop list, but the altered weight values aren't saved to the database. Does this help anyone figure this out?

  if (module_exists('location')) {
    $settings = variable_get('location_settings_node_'. $type_name, array());
    $weight = isset($settings['form']['weight']) ? $settings['form']['weight'] : 0;
    $extra['location'] = array(
      'label' => t('Location Module'),
      'description' => t('Location Module form.'),
      'weight' => $weight
    );
  }

  return $extra;
}
derhasi’s picture

Version: 6.x-3.0-rc2 » 6.x-3.1-rc1

I also tried to solve this issue, but I could not make it, due to intense modification.

My .module is available at http://drupalbin.com/8336 .

I tried the following steps:
* implemenation of hook_content_extra_fields

function location_node_content_extra_fields($type_name) {
  //$type = node_get_types('type', $type_name);
  $settings = variable_get('location_settings_node_'.$type_name,array());
  if ($settings['multiple']['max'] > 0) {
    $weight = isset($settings['form']['weight']) ? $settings['form']['weight'] : 0;
    $extra['locations'] = array(
      'label' => t('Location'),
      'description' => t('Location Node Module form.'),
      'weight' => $weight,
      'view' => 'locations',
    );
  }
  return $extra;
 }

I hoped replacement of 'location' to 'locations' would have changed anything -because 'loactions' is the key getting rendered- , but nothing changed.

* then I tried to change location's settings, after editing the manage fields section, so I added:

	if ($form_id == 'content_field_overview_form') {
    	$form['#submit'][] = 'location_node_content_extra_save';
    }

to location_node_form_alter() and creating

 function location_node_content_extra_save($form, &$form_state) {
  $type = $form['#type_name'];
  $settings = variable_get('location_settings_node_'. $type, array());
   if (isset($form_state['values']['locations'])) {
     $settings['form']['weight'] = $form_state['values']['locations']['weight'];
     $settings['display']['weight'] = $form_state['values']['locations']['weight'];
   }
   variable_set('location_settings_node_'. $type, $settings);
 } 

Editing the variable this way worked, the values changed. But location form and view were still on the same weighted place, as it was before.

So I'm clueless again :(

derhasi’s picture

Status: Active » Needs review
StatusFileSize
new2.2 KB

I worked a little more on the issue, and found some minor bugs of my testing module. (Did some change in location.module, I should not have done).

So with the same idea as the comment above, I created a patch, and it works. Step 1 and 2 were needed - only using location_node_content_extra_fields() seems not to work.

Patch attached. I hope someone will review.

derhasi’s picture

Title: No way to move location order in content type -> manage fields » A way to move location order in content type -> manage fields

changed issue title

bdragon’s picture

Assigned: Unassigned » bdragon
Status: Needs review » Active

Ahh, OK.

Nice patch.

I investigated this a bit, and the reason it doesn't work automatically is CCK is trying to sort things in content_nodeapi op 'view' before location.

Committed a slightly modified version that disables the regular collection weight

http://drupal.org/cvs?commit=179728
http://drupal.org/cvs?commit=179730

Hmm, I just realized that I should be keeping the *display* weight in sync too.

bdragon’s picture

Status: Active » Fixed

OK, I figured I should just go ahead and plain hide the weights, I figure it would be less hassle that way.
If it turns out to be a problem, I can add the link that I had put in in the previous revision back.

http://drupal.org/cvs?commit=179736
http://drupal.org/cvs?commit=179738

Status: Fixed » Closed (fixed)

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

jimmb’s picture

Version: 6.x-3.1-rc1 » 5.x-3.1-rc1
Status: Closed (fixed) » Needs review

I also posted this question here. Can anyone comment on whether this patch will work for Drupal 5? And if not, a revised patch would sure be appreciated.

Jim

ankur’s picture

Status: Needs review » Closed (fixed)

As 5.x is no longer supported.