function editableviews_handler_field_entity_metadata_property::edit_form_element_checkbox in Editable Views 7
Create a checkbox element.
Parameters
&$element: The element to alter.
&$form_state: The form state.
$wrapper: The wrapper for the entity whose property is to be shown in the element.
1 call to editableviews_handler_field_entity_metadata_property::edit_form_element_checkbox()
- editableviews_handler_field_entity_metadata_property::edit_form in handlers/
editableviews_handler_field_entity_metadata_property.inc - Add the edit form for the field.
File
- handlers/
editableviews_handler_field_entity_metadata_property.inc, line 249
Class
- editableviews_handler_field_entity_metadata_property
- Field handler for editing an entity metadata property.
Code
function edit_form_element_checkbox(&$element, &$form_state, $wrapper) {
$default_value = $wrapper->{$this->options['property']}
->raw();
if ($this->options['reverse_boolean']) {
$default_value = !$default_value;
}
$element[$this->options['property']] = array(
'#type' => 'checkbox',
'#required' => !empty($this->property_info['required']),
// The value might not be set in the case where we're on a non-required
// relationship with empty data. TODO???
'#default_value' => $default_value,
);
}