hi!
I try to export a configuration with features but, if I try to revert some components, all breadcrumbs all deleted from database.

Sergio

Comments

spleshka’s picture

Wow, interesting. Thanks, I will check this.

arrubiu’s picture

I'm also working on code, if I find something I'll wrote it :)

kalabro’s picture

After deep research I can say the problem is that path_breadcrumbs actually doesn't support Ctools exportables.

  1. We need to use machine_name as export key. It's obvious. Primary key can live in DB of course (see “Views” schema).
    'export' => array(
          'key' => 'machine_name',
          'primary key' => 'path_id',
          // ...
    

    We can add unique index to 'machine_name' field too.

  2. To work with data both from code and from DB we have to replace db_* stuff with Ctools ctools_export_crud_* functions.
  3. We should replace path_id from UI paths and other important places to allow working with "in code" items.

So, if we want to support Ctools exportables (including Features), we shout do a lot of work with current logic and UI. One more way is to use Ctools export_ui plugin (which “Views” and “Custom content panes” successfuly use) which takes half the work.

Need maintainer's opinion.

spleshka’s picture

Okey, I got your idea. We are really need to add primary key to machine name and replace all db actions with ctools_export_crud. I hope that I will have some free time tonight to make all this changes.

Thanks for the good module review, @kalabro. You are one of the most responsible Drupal developers I ever know, I like this :)

kalabro’s picture

Status: Active » Needs review
StatusFileSize
new36.21 KB

So, here is big patch I have created to solve the problem.

Important notes:

  • Schema modifications are in path_breadcrumbs_update_7214().
  • Cached function path_breadcrumbs_load_by_path() added to load variants by path.
  • Some overhead in path_breadcrumbs_ui_breadcrumbs_list() because we need full objects to save weights.
  • Trying to use $path_breadcrumbs variable instead of $path_breadcrumb and $breadcrumb.
  • git mv path_breadcrumb.api.php path_breadcrumbs.api.php is needed but not included in this patch.

Particular attention was paid to exporting, importing and "feature"-ing.

spleshka’s picture

Version: 7.x-2.0-beta13 » 7.x-2.0-beta14
Status: Needs review » Closed (fixed)

Thanks, very cool!

I spend three hours for patch review. What I did:

  • Removed all empty spaces.
  • Added support for loading multiple object (was required by Ctools bulk export). Made some cosmetic fixes.
  • Fixed bug for !page_title token for static paths.

Finally patch was commited at e4ccf6a and tagged as new 7.x-2.0-beta14 release.