Change record status: 
Introduced in branch: 
7.x-1.x
Description: 

Fieldable Panels Panes (FPP) provides an entity type with custom integration with the Panels module suite. One of the options when creating a new FPP entity is to control whether that entity may be embedded on multiple Panels displays or just the current one the entity is being added to. In addition, because FPP entities have revisions it can be used as part of an editorial workflow process in Panelizer. However, this can lead to unanticipated complexity between the FPP revision, the node revision and various publish states.

In order for the editorial workflow functionality to work correctly, the workflow for new installations of FPP has changed slightly. For new installations of the module, FPP entities which are not set to be reusable are now referenced by their revision ID instead of their primary ID when they are embedded into Panels and Panelizer displays. This has the effect that edits to an FPP embedded in a Panelizer display may be enclosed in the editorial workflow of a node, for use with Workbench Moderation, Revisioning, etc.

Using the new option on existing sites

Sites already using the FPP module may change to this workflow by changing the "Should FPP CTools content panes reference FPP entities by entity ID or revision ID?" option on the settings page (admin/structure/fieldable-panels-panes/settings) to say "Recommended: Use revision ID for non-reusable FPPs only; will also force each FPP update to create a new revision." instead of the default "Legacy: Use entity ID for all FPPs."

Furthermore, existing records in the database will need to be updated to take advantage of the new functionality. There are two methods to do this, though both require use of update scripts (hook_update_N()) on a custom module.

Option 1

The first option involves turning on the setting and then rerunning an FPP update script.

/**
 * Enable the FPP revision locking feature.
 */
function MYMODULE_update_7100() {
  variable_set('fpp_revision_locking', 'lock');
}

/**
 * Rerun Fieldable Panels Panes update 7112.
 */
function MYMODULE_update_7101(&$sandbox) {
  return fieldable_panels_panes_update_7112($sandbox);
}

Option 2

A more correct approach is to use hook_update_dependencies to ensure that the updates happen in the correct order. This may not work because if the hook implementation is newly added to the module it won't be recognized until the caches are cleared, which may not happen until after the updates are ran, thus the updates not running in the correct order.

/**
 * Implements hook_update_dependencies().
 */
function MYMODULE_update_dependencies() {
  // Make sure that update 7100 below runs *after* Fieldable Panels Pane
  // update 7111 and *before* Fieldable Panels Pane update 7112, that way
  // the FPP 'lock' option will be enabled when the Panelizer updates are
  // started.
  $dependencies['MYMODULE'][7100] = array(
    'fieldable_panels_panes' => 7111,
  );
  $dependencies['fieldable_panels_panes'][7112] = array(
    'MYMODULE' => 7100,
  );
  return $dependencies;
}

/**
 * Enable the FPP revision locking feature.
 */
function MYMODULE_update_7100() {
  variable_set('fpp_revision_locking', 'lock');
}

Once one of these options is taken all Panelizer displays will point to non-reusable FPPs via their revision ID, making them work with a Panelizer-based editorial workflow using Workbench Moderation, Revisioning, etc.

Impacts: 
Site builders, administrators, editors