How To Disable Custom Panel Page Programmatically?

You can automatically disabled custom panel page  via hook_update_N.  After little digging around in CTools module codebase, I ended up with the following code snippet.

$page = page_manager_get_page_cache('<page_name>'); // Replace <page_name> 
$function = ctools_plugin_get_function($page->subtask, 'enable callback');
$result = $function($page, TRUE);

  1. #1 by colan on September 5, 2014 - 4:56 pm

    To enable, you have to do something similar. See for details.

  2. #2 by takimislam on September 8, 2014 - 3:03 pm

    Thanks for you share Colan. Keep helping Drupal guys.

  3. #3 by Kuldeep Singh Pal on April 20, 2015 - 1:03 pm

    Thank you much for sharing.. It saved my lot of time.

  4. #4 by Randall Goya on September 9, 2016 - 8:54 pm

    code doesn’t work for me – this worked

    $cache = page_manager_get_page_cache(”);
    $page = $cache->subtask[‘subtask’];
    ctools_export_set_object_status($page, TRUE);
    $page->disabled = TRUE;

  5. #5 by Randall Goya on September 9, 2016 - 9:01 pm

    The problem is that page_manager_page_enable always sets $page->disabled = FALSE;

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: