Using some dynamic value replacements in style properties is currently not possible without hacking module code (modules/openlayers_ui/plugins/export_ui/openlayers_styles_ui.class.php file). It's because dynamic value replacements are not evaluated before checking the value of style property value.

So we need to:

  • be able to set view (and display) to check the dynamic value replacements against
  • load that view and check type of every value in corresponding field
  • report problems that have been found to the style editor

Original question:

I had an issue with letting the ${count} attribute control the radius og the styles. At first it did not work, but I then hacked the style form and removed the check that only allowed numbers in the point radius field. And it worked, the gouping count can then deside the size of the markers.

But why is this not allowed in the first place? I propose to remove this check so one can enter relative values.

Comments

Pol’s picture

Status: Active » Postponed (maintainer needs more info)

Hello,

If you provide a patch I'll include it asap.

Thanks !

falster’s picture

I am sorry but I don't know how to make an patch, I'm not an programmer...

But anyhow.
In the file openlayers/modules/openlayers_ui/includes/openlayers_ui.styles.inc

On the line 32 -33 remove this:

'type' => 'integer',
      'element_validate' => array('element_validate_integer_positive'),
Pol’s picture

I'm sorry I don't have such file, could you be more specific ?

Also, for which field you want to remove that check and why ? Could you develop ?

Thanks.

falster’s picture

I don't quite understand. It is in the openlayers module. Under the user interface I can find openlayers_ui.styles.inc

Are you sure you don't find the file?

But the field in question is the point radius field, who sets the size of the marker.

This:

 'pointRadius' => array(
      'default' => 6,
      'desc' => t('The radius of a vector point or the size of
        an icon. Note that, when using icons, this value should be half the
        width of the icon image.'),
      'type' => 'integer',
      'element_validate' => array('element_validate_integer_positive'),
    ),

The last check only allows numbers to be entered, I want to enter an attribute like ${number_from_views}, wich is completely possible apart from the check in the form.

Pol’s picture

I'm not aware that we can replace this by tokens, I will check this out.

Thanks !

Pol’s picture

Assigned: Unassigned » Pol
Status: Postponed (maintainer needs more info) » Needs work
Pol’s picture

Status: Needs work » Fixed

It should be fixed now.

Status: Fixed » Closed (fixed)

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

milos.kroulik’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

There are other style properties, that can be defined dynamically, so I decided to reopen this issue. For my usecase I needed to set dynamic strokeWidth, which has to be positive integer. It succeeded only after disabling check in modules/openlayers_ui/plugins/export_ui/openlayers_styles_ui.class.php. Perhaps we should name the issue differently like "Evaluate dynamic replacement value before checking correct style property value"?

Pol’s picture

Could be a good idea to implement.

Patches are welcome !

milos.kroulik’s picture

Title: allow more attributes in styles » Evaluate dynamic replacement value before checking correct style property value
Version: 7.x-2.0-beta3 » 7.x-2.x-dev
Issue summary: View changes

Thanks for response! I don't have required time (and probably knowledge) right now, but will definitely try to work on this in the future. I modified the issue in proposed manner, hopefully it's OK.

milos.kroulik’s picture

Status: Active » Closed (duplicate)

This is duplicate of https://drupal.org/node/2241391

  • Pol committed 0663a28 on 7.x-3.1.x
    Fix #1951336, #1907096 and #1949392.