You are here

function _focal_point_preview_link in Focal Point 7

Build a render array for the preview link.

Parameters

int $fid: The fid of the file entity in question.

string $indicator_id: (Optional) The id of the focal point indicator. This is needed to support image fields that have a cardinality greater than one, and forms in modals.

string $focal_point: (Optional) In the form xx,yy where xx represents the left offset as a percent and yy represents the top offset as a percent.

Return value

mixed A render array for the preview link.

2 calls to _focal_point_preview_link()
focal_point_preprocess_image_widget in ./focal_point.module
Implements template_preprocess_image_widget().
_focal_point_form_append_focal_point_preview in ./focal_point.module
Append the focal point preview field to file edit forms.

File

./focal_point.module, line 811

Code

function _focal_point_preview_link($fid, $indicator_id = 'focal-point', $focal_point = '') {
  if (!user_access('preview focal point')) {
    return;
  }
  $focal_point = empty($focal_point) ? FOCAL_POINT_DEFAULT : $focal_point;
  $link_text = t('Image Preview');
  $link_path = 'focal_point/preview/' . $fid . '/' . $focal_point;
  return array(
    '#type' => 'markup',
    '#markup' => l($link_text, $link_path, array(
      'attributes' => array(
        'target' => '_blank',
        'class' => array(
          'focal-point-preview-link',
          'overlay-exclude',
        ),
        'data-focal-point-id' => $indicator_id,
      ),
    )),
  );
}