Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Clone the entity to avoid messing with it.
- $entity_type = $element['#entity_type'];
- if (!isset($form_state[$entity_type])) {
- return;
- }
- $cloned_entity = clone $form_state[$entity_type];
- $element['fixed_field'] = field_view_field($entity_type, $cloned_entity, $field['field_name'], $display, $langcode);
- $element['fixed_field']['#ajax'] = array(
- 'callback' => 'fixed_field_ajax_get_value',
- 'event' => 'click',
- 'method' => 'replace',
- 'wrapper' => 'fixed_field-div',
- );
- $element['fixed_field']['#prefix'] = '<div id="fixed_field-div">';
- $element['fixed_field']['#suffix'] = '</div>';
- $output = $element;
- if (($settings['user_edit_perm']==TRUE) && user_access('edit_fixed_content')) {
- $output['edit'] = array(
- '#markup' => '<input type="button" onclick="alert()" value="'.t('Edit').'" />',
- );
- }
- }
- return $output;
- }
- function fixed_field_ajax_get_value($form, $form_state) {
- return array('#markup'=>'qwertyuiop');
- }
Add Comment
Please, Sign In to add comment