Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When trying to export Drupal configuration with the Configuration module, I was getting the following errors:
Warning: get_class() expects parameter 1 to be object, array given in ctools_export_object() (line 902 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 937 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 934 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
Warning: Attempt to assign property of non-object in ctools_export_object() (line 934 of /data/disk/o4328175677/distro/010/drupal-7.22.1-dev/sites/all/modules/ctools/includes/export.inc).
The problem is Configuration is creating its .inc files with
public function getDataToSave() {
$filename = $this->filename;
ctools_include('export');
$export = '$api = ' . $this->export($this->api_version) . ";\n\n";
$export .= '$data = ' . ctools_export_crud_export($this->table, $this->data) . "\n\n";
$export .= '$dependencies = ' . $this->export($this->dependencies) . ";\n\n";
$export .= '$optional = ' . $this->export($this->optional_configurations) . ";\n\n";
$export .= '$modules = ' . $this->export($this->required_modules) . ";";
$file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n";
$this->hash = sha1($file_contents);
return $file_contents;
}
which results in the case of Breakpoints group to
$api = '2.0.0';
$data = // Breakpoints.
$breakpoints = array();
$breakpoints[] = 'breakpoints.theme.classicaldiary.mobile';
$breakpoints[] = 'breakpoints.theme.classicaldiary.narrow';
$breakpoints[] = 'breakpoints.theme.classicaldiary.wide';
// Breakpoint group.
$breakpoint_group = new stdClass();
$breakpoint_group->disabled = FALSE; /* Edit this to true to make a default breakpoint_group disabled initially */
$breakpoint_group->api_version = 1;
$breakpoint_group->machine_name = '9_columns_4_orbit';
$breakpoint_group->name = '9 columns - 4 orbit';
$breakpoint_group->breakpoints = $breakpoints;
$breakpoint_group->type = 'custom';
$breakpoint_group->overridden = 0;
$dependencies = array();
$optional = array();
$modules = array(
0 => 'ctools',
1 => 'breakpoints',
);
Meaning the $data variable is actually an empty array instead of the $breakpoint_group object.
Patch following...
Comment | File | Size | Author |
---|---|---|---|
#1 | support_configuration_module-2203053-1.patch | 1.52 KB | jibize |
Comments
Comment #1
jibize CreditAttribution: jibize commentedInstead of breakpoint_group_export_breakpoints() returning a variable name as a sting it returns the string representation of the breakpoints array.
Comment #2
attiks CreditAttribution: attiks commentedI'll try to test this one of these days.
Comment #3
attiks CreditAttribution: attiks commentedComment #4
Jelle_SFixed in latest dev. Thanks for the patch! (I made some small changed to it)