0

I have a "node_view" panel pane, with a few variants.

Say a variant called node_view_panel_context_9, and I would like to delete this variant programmatically using code (from a hook_update_N hook to be specific).

What are the correct API functions/methods to use?

1

I just had to do this recently. If the variant is exported to code (like in a Feature) this will revert it. Otherwise it will just delete it.

   function MY_MODULE_update_N() {
     ctools_include('export');
     $page = ctools_export_crud_load('page_manager_handlers', 'node_view__test123');
     ctools_export_crud_delete('page_manager_handlers', $page);
   }
  • 1
    Thanks for the answer. But this was not it. ctools_export_crud_load's first argument is table name in database. But most of the handlers I have are not in that table or in the database anywhere. I came to the conclusion that it's not stored in DB unless it's overridden, so if you just remove the handler from your feature then it goes away after a cc all. Would be great to get confirmation on this from someone who knows ctools storage logic. – Beebee May 26 '15 at 8:58
  • Following the docs at drupalcontrib.org/api/drupal/… and in practice in fact, simply deleting the snippet defining any ctools defined handler (like a Page in Page Manager in my case) from your exported code in fact removes it from the Drupals. They are not stored in one of the page_manager_.. tables, and I did not find anything but the rendered assets in cache_.. tables. Long and the short: manually edit your export code and deploy! (backup first) – texas-bronius Nov 3 '15 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.