You are here

function _focal_point_field in Focal Point 7

Define the focal point text field.

Parameters

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 $default_value: The default value of the field.

bool $access: (Optional) Whether or not the field should be accessible.

Return value

array A FAPI field array for the focal point value.

3 calls to _focal_point_field()
focal_point_test_drive_form in ./focal_point.admin.inc
Form builder for the "test drive" page.
focal_point_widget_process in ./focal_point.module
Field widget process function.
_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 536

Code

function _focal_point_field($indicator_id = 'focal-point', $default_value = FOCAL_POINT_DEFAULT, $access = TRUE) {
  return array(
    '#type' => 'textfield',
    '#title' => 'Focal Point',
    '#description' => t('Specify the focus of this image in the form "leftoffset,topoffset" where offsets are in percents. Ex: 25,75'),
    '#default_value' => $default_value,
    '#access' => $access,
    '#element_validate' => array(
      'focal_point_element_form_validate',
    ),
    '#attributes' => array(
      'class' => array(
        'focal-point',
      ),
      'data-focal-point-id' => $indicator_id,
    ),
    '#attached' => array(
      'js' => array(
        drupal_get_path('module', 'focal_point') . '/js/focal_point.js',
      ),
      'css' => array(
        drupal_get_path('module', 'focal_point') . '/css/focal_point.css',
      ),
    ),
  );
}