function hook_eck_property_widget_form in Entity Construction Kit (ECK) 7.3
Callback to retrieve the form elements for a module's property widget.
This same hook will be called for every property widget type defined by a given module.
This callback operates very similar to that of Drupal's field api hooks.
The form may be altered using hook_eck_property_widget_form() and hook_eck_property_widget_WIDGET_TYPE_form().
Parameters
array $form: A reference to the parent form. Could be the entity form, the widget settings form, etc.
array $form_state: A reference to the current state of the form.
string $property_name: The machine name of the property for which to retreive the widget form.
array $bundle_property_config: The bundle's configuration setting stored for the property. Contains all of the widget's settings and default info for the property.
string $langcode: The current language.
mixed $value: The property's current value to use in the widget.
array $element: The form element to use for the property widget. Default info included.
Return value
array the form element for a particular widget.
See also
eck_eck_property_widget_info()
hook_eck_property_widget_form()
hook_eck_property_widget_settings_form()
hook_eck_property_widget_WIDGET_TYPE_form()
1 function implements hook_eck_property_widget_form()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- eck_eck_property_widget_form in ./
eck.property_widgets.inc - Implements hook_eck_property_widget_form().
File
- ./
eck.api.php, line 121 - ECK's API documentation.
Code
function hook_eck_property_widget_form(&$form, &$form_state, $property_name, $bundle_property_config, $langcode, $value, $element) {
if ($bundle_property_config['widget']['type'] == 'text') {
$element += array(
'#type' => 'textfield',
'#default_value' => isset($value) ? $value : NULL,
'#size' => $bundle_property_config['widget']['settings']['size'],
'#maxlength' => $bundle_property_config['widget']['settings']['max_length'],
'#attributes' => array(
'class' => array(
'text-full',
),
),
);
}
return $element;
}