You are here

function quickedit_field_form in Quick Edit 7

Form constructor; in-place editing form for a (single) Field API or "extra" field.

For Field API fields, the quickedit_field_edit_form subform will be used. For "extra" fields, the subform indicated in hook_quickedit_extra_fields_info() will be used.

See also

quickedit_field_edit_form()

6 string references to 'quickedit_field_form'
QuickEditLoadingTest::testConcurrentEdit in ./quickedit.test
Tests Quick Edit with concurrent node / Quick Edit use.
QuickEditLoadingTest::testCustomPipeline in ./quickedit.test
Tests that Quick Edit works with custom render pipelines.
QuickEditLoadingTest::testTitleBaseField in ./quickedit.test
Tests the loading of Quick Edit for the title base field.
QuickEditLoadingTest::testUserWithoutPermission in ./quickedit.test
Test the loading of Quick Edit when a user doesn't have access to it.
QuickEditLoadingTest::testUserWithPermission in ./quickedit.test
Tests the loading of Quick Edit when a user does have access to it.

... See full list

File

includes/pages.inc, line 401
AJAX endpoint to retrieve & save subforms for fields and re-render fields.

Code

function quickedit_field_form($form, &$form_state, $entity, $field_name) {
  $form['#parents'] = array();
  form_load_include($form_state, 'inc', 'quickedit', 'includes/fape');
  if ($form_state['subform_id'] && function_exists($form_state['subform_id'])) {
    $form_state['subform_id']($form, $form_state, $entity, $field_name);
  }

  // Add a submit button. Give it a class for easy JavaScript targeting.
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#attributes' => array(
      'class' => array(
        'quickedit-form-submit',
      ),
    ),
  );

  // Remove http://drupal.org/project/metatag form elements.
  // @see http://drupal.org/node/1895142
  unset($form['#metatags']);

  // Tell http://drupal.org/project/redirect to not add form elements.
  // @see http://drupal.org/node/1935676
  $form['redirect'] = array();

  // Simplify it for optimal in-place use.
  quickedit_field_form_simplify($form, $form_state);
  return $form;
}