Problem/Motivation

Currently, it is not possible to alter the $content_type array generated by the CTools content type in fieldable_panels_panes_fieldable_panels_pane_content_type(). A site builder may desire to alter this array for a number of reasons. For example, a site builder may wish to display a particular revision of a reusuable FPP.

Proposed resolution

Add a hook_fieldable_panels_panes_fieldable_panels_pane_content_type_alter() function:

    // If there's only 1 and we somehow have the wrong subtype ID, do not
    // care. Return the proper subtype anyway.
    if (empty($content_type) && !empty($plugin['single'])) {
      $content_type = current($subtypes);
    }
  }

+   drupal_alter('fieldable_panels_panes_fieldable_panels_pane_content_type', $content_type, $subtype_id, $plugin);
+ 
  return $content_type;
}

/**
 * Callback to return the custom content types with the specified $subtype_name.

Remaining tasks

None

User interface changes

None

API changes

Add note in release about new hook_fieldable_panels_panes_fieldable_panels_pane_content_type_alter() function.

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chris Burge created an issue. See original summary.

Chris Burge’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
508 bytes
DamienMcKenna’s picture

Status: Needs review » Needs work

Interesting change. This needs some documentation before it can be committed.

Chris Burge’s picture

Assigned: Unassigned » Chris Burge
Chris Burge’s picture

Chris Burge’s picture

Forgot the "_alter" at the end of the function name in the api documentation.

DamienMcKenna’s picture

DamienMcKenna’s picture

Title: Allow CTools Content Type to be Altered » Allow CTools content type to be altered

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.