function entityconnect_add_form_element_new in Entity connect 7
Same name and namespace in other branches
- 7.2 includes/entityconnect.form.inc \entityconnect_add_form_element_new()
Here we attach a "Add" submit button.
1 call to entityconnect_add_form_element_new()
- _entityconnect_field_attach_form in includes/
entityconnect.form.inc - Implements hook_field_attach_form().
File
- includes/
entityconnect.form.inc, line 206 - Handles all form alters and submit functions for entityconnect.
Code
function entityconnect_add_form_element_new(&$widget_element, $language, $field_name, $parents, $key, $extra_class, $instance, $entity_type, $acceptable_types = NULL) {
$widget_element["add_entityconnect__{$field_name}_{$key}_{$parents}"] = array(
'#type' => 'submit',
'#limit_validation_errors' => array(),
'#value' => t('New content'),
'#name' => "add_entityconnect__{$field_name}_{$key}_{$parents}",
'#prefix' => "<div class = 'entityconnect-add {$extra_class}'>",
'#suffix' => '</div>',
'#key' => $key,
'#field' => $field_name,
'#entity_type_target' => $entity_type,
'#acceptable_types' => $acceptable_types,
'#add_child' => TRUE,
'#language' => $language,
'#submit' => array(
'entityconnect_include_form',
'entityconnect_add_edit_button_submit',
),
'#weight' => -2,
'#attached' => array(
'js' => array(
drupal_get_path('module', 'entityconnect') . "/theme/js/entityconnect.js",
),
'css' => array(
drupal_get_path('module', 'entityconnect') . "/theme/css/entityconnect.css",
),
),
'#attributes' => array(
'title' => t('Add'),
// Support Clientside Validation.
'class' => array(
'cancel',
),
),
);
}