I have 2 content types, each of which have an image field that I'm using Focal Point with.

When creating a node with the first content type, the image field behaves correctly on uploading a new image in that the crosshair is in the middle and I can drag it to reposition.

But on the second content type, when I upload a new image the crosshair is shown in the top left and cannot be dragged. Saving the node and editing, then restores the correct behaviour.

I've checked the field settings on both content types and they seem to be identical, so I'm stumped why it works fine on one but not on the other. Any thoughts?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

martinjbaker created an issue. See original summary.

bleen’s picture

It sounds like you have a javascript error of some kind on the node add form for the second content type that is breaking all the javascript on the page.

SpaghettiBolognese’s picture

Version: 7.x-1.0-beta6 » 7.x-1.1
Category: Support request » Bug report
Status: Active » Needs review
FileSize
888 bytes

jQuery.ui draggable gets added in _focal_point_indicator(). This is too late for new content. We're also seeing some content-types where focal-point does work, but these content-types have metatag module enabled which adds ui.draggable itself.

The patch adds jQuery.u draggable earlier and should fix the bug.

DamienMcKenna’s picture

FileSize
794 bytes

As the docs for drupal_add_library() say, the proper way of adding a library to a render/form element is to use the #attached statement:

    '#attached' => array(
      'library' => array(
        array(
          'system',
          'ui.draggable',
        ),
      )
    ),
bleen’s picture

Status: Needs review » Fixed

  • bleen committed 72b2cf3 on 7.x-1.x authored by DamienMcKenna
    Issue #2699577 by SpaghettiBolognese, DamienMcKenna: Odd inconsistency...
DamienMcKenna’s picture

Thanks for the quick commit, bleen!

Status: Fixed » Closed (fixed)

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