I am setting up a site using authcache_p13n to populate my panes

This works perfectly for some custom content types I have but when the panes are generated by pm_existing_pages this does not work :(

I have tried adding pm_existing_pages => AuthcachePageManagerUserTaskContextProvider in hook_authcache_page_manager_task_context_provider of a custom module but this hook isn't getting called either

I'm wondering if the issue is similar to this Authcache not working on content in Mini Panels

Any help or info on this would be greatly appreciated

Thanks

Tom

Comments

TomGould01 created an issue. See original summary.

znerol’s picture

I guess this is about the module Page manager existing pages. I had a very quick look at the project and its source code. Regrettably I cannot tell yet whether or not providing support for that module can be achieved.

In order to make it simpler for others to join in, could you please write down some steps necessary to reproduce the problem, assuming that Drupal core, Panels and Page manager existing pages are installed and enabled.

TomGould01’s picture

Hi Zenerol, thanks for looking at this :)

The steps to reproduce would be:

1. Enable authcache and the modules listed below so that you can provide personalizations in panes
2. navigate to a page provided by a menu callback that Page manager existing pages allow you to customize
3. customize it and save the changes
4. go to the pages interface and change the caching mechanism of this pane created to authcache
5. go back to the page with customizations, at this stage, you should notice that the pane provided by pm_existing_pages is empty as the "$handler->handle($req);" has no context and therefore returns an empty response for this frag

I am currently experimenting with providing a custom context provider through the _authcache_page_manager_task_context_provider hook but haven't had any joy so far

My goal is to provide a way that any pm_existing_pages pane created by customizing existing pages can then be served through authcache_p13n if required without having to make specific changes in code for each individual pane

Modules installed:
authcache, authcache_ajax, authcache_block, authcache_debug, authcache_enum, authcache_field, authcache_form, authcache_menu, authcache_page_manager, authcache_panels_page_manager, authcache_panels, authcache_p13n, authcache_views

Also, one custom module to provide the hook and extra context provider

Just to be clear the custom ctools content type and other type panes are working perfectly, it is only the panes provided by pm_existing_pages that I am having issues with

Thanks again for looking at this

Best

Tom

TomGould01’s picture

Adding the context provider worked for this case

FYI here are the changes:

New Class

<?php
/**
 * @file
 * Defines context provider collecting page manager context from path.
 */

/**
 * Collect arguments and contexts from current menu router item path.
 *
 * Use this context provider when rendering page manager page tasks.
 */
class XXXAuthcachePageTaskContextProvider extends AuthcachePageManagerDefaultTaskContextProvider {

  /**
   * @inheritDoc
   */
  protected function taskContext(array $page_arguments = []) {
    return array(
      'context' => array(),
      'arguments' => [
        0 => [],
        1 => [],
        2 => $page_arguments[0]
      ],
    );
  }
}

And the hook

/**
 * Implements hook_authcache_page_manager_task_context_provider().
 */
function XXX_authcache_authcache_page_manager_task_context_provider() {
  return array(
    'pm_existing_pages' => 'XXXAuthcachePageTaskContextProvider',
  );
}

znerol’s picture

Title: Authcache not working on content with pm_existing_pages » Support Page manager existing pages (pm_existing_pages)
Version: 7.x-2.2 » 7.x-2.x-dev
Category: Bug report » Feature request

Thanks for posting your findings. It looks like page manager existing pages is used quite widely. Hence maybe there would be a benefit for others if authcache would provide support for that module out of the box.

I'll leave this open as a feature request, so that other people can chip in and declare their interest.