You are here

function _entityreference_autofill_supported_widgets in Entity reference autofill 7

Widget form array paths keyed by widget type.

This function defines which widgets are supported by the module (by array keys). The values are the path in the widget element where the AJAX callback is attached.

Parameters

string $widget_type: (optional) Widget type to get ajax base path for.

Return value

array Array of widget machine names that this module support, or ajax base path if $widget_type is set.

See also

entityreference_autofill_field_widget_form_alter()

2 calls to _entityreference_autofill_supported_widgets()
EntityReferenceAutofillInstanceBehavior::access in plugins/behavior/EntityReferenceAutofillInstanceBehavior.class.php
Only show handler on supported widget types.
entityreference_autofill_field_widget_form_alter in ./entityreference_autofill.module
Implements hook_field_widget_form_alter().

File

./entityreference_autofill.module, line 412
Entity reference autofill module.

Code

function _entityreference_autofill_supported_widgets($widget_type = FALSE) {
  $supported_widgets = array(
    'entityreference_autocomplete' => array(
      'target_id',
    ),
    'options_select' => array(),
    'options_buttons' => array(),
  );

  // Allow other modules to add other widgets support.
  $additional_widgets = module_invoke_all('entityreference_autofill_supported_widgets');
  $supported_widgets += $additional_widgets;
  if ($widget_type) {
    return isset($supported_widgets[$widget_type]) ? $supported_widgets[$widget_type] : FALSE;
  }
  return $supported_widgets;
}