Hi,

Great module as it is.

It would be better if it has Focal Point integration on the edit form of the field.

Any plans?

Thank you and have a nice day.

Rgds,
Karl

Comments

karltud123 created an issue. See original summary.

karltud123’s picture

Issue summary: View changes
firewaller’s picture

Status: Active » Needs review

I've managed to integrate focal_point by adding the following to a custom module. Its great because the individual click events and hover events are preserved.

/**
 * Implements hook_focal_point_supported_widget_types_alter().
 */
function MY_MODULE_focal_point_supported_widget_types_alter(&$supported) {
  // Add integration with module Nice ImageField Widget.
  if (module_exists('nice_imagefield_widget')) {
    $supported[] = 'image_nice';
  }
}

/**
 * Implements template_preprocess_nice_imagefield_widget_image().
 */
function MY_MODULE_preprocess_nice_imagefield_widget_image(&$variables) {
  // Preprocess module template.
  if (module_exists('focal_point')) {
    focal_point_preprocess_image_widget($variables);
  }
}

/**
 * Implements template_preprocess_nice_imagefield_widget_multiple().
 */
function MY_MODULE_preprocess_nice_imagefield_widget_multiple(&$variables) {
  // Inherit from above.
  MY_MODULE_preprocess_nice_imagefield_widget_image($variables);
}

I also had to update the CSS like so:

.focal-point-wrapper .focal-point-indicator {
  z-index: 101;
}

If you want to determine where the hidden input textfield goes, you can this to a custom template (i.e. MY_TEMPLATE_nice_imagefield_widget_image()):

if (isset($element['focal_point']) && ((isset($element['focal_point']['#access']) && $element['focal_point']['#access']) || !isset($element['focal_point']['#access']))) {
  $output .= drupal_render($element['focal_point']);
}
terry_kolodiy’s picture

Status: Needs review » Closed (outdated)

D7-related issue. Closed since Drupal 7 is not supported.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.