When installing this module while custom_search is enabled, I don't get the permissions or the default yaml forms. All works well when installing without custom search.

Here is the output:

$ drush en yamlform -y
The following extensions will be enabled: yamlform
Do you really want to continue? (y/n): y
PHP Fatal error:  Call to a member function get() on null in .../dev/modules/custom_search/custom_search.module on line 22
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to a member function get() on null in
.../dev/modules/custom_search/custom_search.module,
line 22
$ drush pm-uninstall yamlform
The following extensions will be uninstalled: yamlform
Do you really want to continue? (y/n): y
yamlform was successfully uninstalled.                               [ok]
$ drush pm-uninstall custom_search
The following extensions will be uninstalled: custom_search
Do you really want to continue? (y/n): y
custom_search was successfully uninstalled.                          [ok]
$ drush en yamlform -y
The following extensions will be enabled: yamlform
Do you really want to continue? (y/n): y
yamlform was enabled successfully.                                   [ok]
yamlform defines the following permissions: access yamlform overview, administer yamlform submission, administer yamlform
$

And btw, This module is an amazing idea. I love it.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alayham created an issue. See original summary.

jrockowitz’s picture

I was able to duplicate the issue using https://simplytest.me/ (custom_search 8.x-1.0-beta2 & yamlform 8.0.3-dev).

As noted the error is `Fatal error: Call to a member function get() on a non-object in /home/dmajw/www/sites/default/modules/custom_search/custom_search.module on line 22`

I am pretty sure the issue is in the custom search module.

Below is the code with the issue commented in ALLCAPS. Here is a link to the code in the custom_search.module repository. http://cgit.drupalcode.org/custom_search/tree/custom_search.module#n22

/**
 * Implements hook_entity_bundle_create().
 */
function custom_search_entity_bundle_create($entity_type, $bundle) {
  if ($entity_type == 'node') {
    // Add default config for Results settings.
    $search_pages = entity_load_multiple('search_page');
    foreach ($search_pages as $page) {
      $pageId = $page->id();
      // THE BELOW $config VARIABLE IS NOT DEFINED.
      $advanced_types = $config->get($pageId . '.advanced.types');
      $advanced_types[$bundle] = $bundle;
      \Drupal::configFactory()->getEditable('custom_search.settings.results')->set($pageId . '.advanced.types', $advanced_types)->save();
    }
  }
}

Attached is PHPStorm calling out the error with a red squiggly underline.

jrockowitz’s picture

Project: YAML Form » Custom Search
jrockowitz’s picture

I am going to move this ticket the custom_search.module's issue queue.

jdanthinne’s picture

Status: Active » Closed (duplicate)
alayham’s picture

Title: Fatal error when installing with custom_search enabled. » Fatal error when installing yamlform with custom_search enabled.