I'm getting the error

Fatal error: Call to undefined function bootstrap_form_process() in /srv/http/*****/includes/form.inc on line 1870

When editing a display mode of a node... in the seven theme.

Comments

MartijnBraam created an issue. See original summary.

markhalliwell’s picture

Status: Active » Closed (duplicate)
Related issues: +#2156371: Fatal error: Call to undefined function _bootstrap_process_element()

I cannot reproduce this. See related issue.

Anonymous’s picture

Yes, I know this is task is closed, and yes, I've reviewed everything in the related issue and I get how it's not Boostrap theme's fault. But I've spent so many hours trying to find a way to work around the underlying issue and Google points to these issues when you search for the error message Fatal error: Call to undefined function bootstrap_form_process() in /srv/http/*****/includes/form.inc on line 1870 that I'm posting what resolved the issue for my circumstance for other poor souls who may benefit.

Conditions:
- Custom entity type type Story Block with two bundles, Section and Block
- Nested entity references using Inline Entity Form (content type references Section; Section references Block)
- Adminimal (non-Bootstrap) admin theme
- Custom Theme that started life as the Bootstrap contrib theme

Steps to reproduce:

  1. Create a new page or edit an existing page that contains an entity reference to a Section custom entity.
  2. Add or edit an entity reference Section (which has an entity reference to a Block custom entity) using an Inline Entity Form.
  3. Add or edit an entity reference Block using an Inline Entity Form.
  4. Save the Block.
  5. Save the Section.
  6. The entity reference table switches styles from Admininal to the Custom Theme. The inline entity forms are now using styles from the Custom Theme, which makes them look broken.
  7. Save the node. Fatal error message. Log shows: Error: Call to undefined function _CUSTOMTHEME_process_element() in form_builder() (line 1871 of /var/www..../includes/form.inc

I found a variety of questions and answers here and on Stackexchange that pointed in the direction of system/ajax not having clear direction on what theme to use and without that, it will use the default theme, in my case, the Custom Theme. Using hook_admin_paths has resolved the issue.

/*
 * Implements hook_admin_paths.
 * Render entity edit pages in admin theme.
 */
function webstory_theme_admin_paths() {
  $paths = array (
    // Story Block custom entity forms.
    'story_block/*/*/edit' => TRUE,
    'story_block/*/add' => TRUE,
    // Force ajax callbacks to use admin theme.
    'system/ajax' => TRUE,
  );
  return $paths;
}

Would it be better for Inline Entity Forms module to fix it so that the admin theme (or whatever theme is used on the page when you start editing) is used for the duration of the edit session? Probably so. Lacking that and considering that I don't see a way to patch IEF to accomplish that, this works for me.

The suggestion here https://www.drupal.org/node/2156371#comment-10637278 may also work, but I had some issues with ThemeKey, so hook_admin_paths worked better in my case.

ph7’s picture

My use case is almost the same as described in this issue with the exception of the custom content type. In my case the error appears in an image field that's part of a profile2 custom profile. Specifically when I try to add and save a default image to the field. The default image widget uses ajax.

I would argue that whenever bootstrap and adminimal are enabled an unforced ajax callback will trigger this error.
Using a similar hook_admin_paths function provided in this ticket solved my problem.

only4kaustav’s picture

I tried to find possible solution and many users are telling that Changing max_input_vars in PHP have solve the issue but it didn't solve the issue for me. This error occur on non bootstrap theme while we are trying to upload a file/image by file browser input element of a form. Actually while uploading a file it is using a ajax url(you can check it in inspect panel network tab) which is invoking bootstrap theme and add _bootstrap_process_element in submit hook. So either we need to stop this url to invoke bootstrap theme while calling from non bootstrap theme or form need to be load in bootstrap theme.

For our case "file/ajax/*" url creating the issue. For that we implement hook_custom_theme and specify this url to load admin theme (non bootstrap theme)

/**
 * Implements hook_custom_theme.
 */
function YOURMODULE_custom_theme() {
  if (drupal_match_path(current_path(), 'file/ajax/*')) {
    global $conf;
    return $conf['admin_theme'];
  }
}
phuocdv’s picture

thanks only4kaustav (#5) . your solution has resolved the issue for me.