Would be great if we could use a different 'process callback' or 'attributes callback' for an existing shortcode.
Doing so would also solve issues like #1879704: Make classes configurable

Comments

BarisW’s picture

Project: Basic Shortcodes Library » Shortcode
Version: 7.x-1.x-dev » 7.x-2.x-dev

Wrong project

BarisW’s picture

Status: Active » Needs review
StatusFileSize
new2.21 KB

That was easy, patch attached.

BarisW’s picture

Can be used to alter the shortcodes like this:

<?php
/**
 * Implements hook_shortcode_info_alter().
 * Alter existing shortcodes.
 */
function MYMODULE_shortcode_info_alter(&$shortcodes) {
  // Change the implementation of the 'box' shortcode to custom settings.
  $shortcodes['box'] = array(
    'title' => t('Box'),
    'description' => t('Place a colored box next to the text.'),
    'process callback' => 'prestocentre_base_shortcode_box',
    'tips callback' => 'prestocentre_base_shortcode_box_tip',
    'attributes callback' => 'prestocentre_base_shortcode_box_settings'
  );

  // Don't use the Toggle shortcode at all.
  unset($shortcodes['toggle']);
}
?>
ericmulder1980’s picture

Status: Needs review » Reviewed & tested by the community

Looks good and works for me!

denes.szabo’s picture

Thanks BarisW! I will check it soon and commit to the the dev version!

denes.szabo’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Thx, I added your patch to the dev and rolled out the stable 2.0 version from shortcode.

(http://drupalcode.org/project/shortcode.git/commit/7fa3469ae1710ec53ab28...)

BarisW’s picture

Amazing, thanks!