The WKT field is not the nicest thing for end-users to see, so I'd like to propose a feature that allows the hiding (and showing) of it.
This post is a result of the issue discussed here: #881194: Configurable search address field position.

The attached patch uses jQuery to initially hide the field and creates a link that'll show it again (and vice-versa).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zzolo’s picture

Hi @BWPanda. Many thanks for the patch. I am all about this, but there are a number of things not ideal with with your patch:

1) You are not using t() correctly
2) This should be in a separate JS file (unless there already is one for the CCK field)
3) You should utilize Drupal's JS settings to pass along the field name

Otherwise the idea is solid.

BWPanda’s picture

Status: Needs review » Needs work
FileSize
2.14 KB

Thanks zzolo, glad you like the idea.

I've edited the patch to:
1) Use t() properly
2) Add jQuery code to existing .js file
3) Send field name and t() function output to JS settings

However, there's an issue when you have two maps on the same content type...
I have two OpenLayers maps on my Page content type ('field-location' and 'field-dummy') and the code doesn't work at all.
I ran an alert() in the .js file on 'wktField' and it outputs: 'field-location,field-dummy'. The PHP code is obviously adding the different fields to the same JS setting, but I couldn't work out how to fix it. If you can fix that for me, it should work fine.

Thanks!

zzolo’s picture

Status: Needs work » Fixed

Ok, committed. It is the way that PHP (drupal_add_js) does its array merges. It should be working fine:

http://drupal.org/cvs?commit=412908

Status: Fixed » Closed (fixed)

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

Yanxi’s picture

I am wondering if it's possible to completely hide the WKT field even without the link to show it? Or it would be even better to make it an option (display or not) in the administration interface.

tmcw’s picture

Yanxi: no, that currently isn't an option, but it would be simple to use CSS to hide the link in your theme.

zzolo’s picture

Hi @Yanxi. @tmcw makes a good suggestion. Though this would be a nice option to have for the CCK widget, so people don't need to have to edit a theme. You can create a new issue for the feature request if you want.