Popup-Maker icon indicating copy to clipboard operation
Popup-Maker copied to clipboard

PM v1.7 Extension Migrations - Required Changes List

Open danieliser opened this issue 7 years ago • 2 comments

This list describes the needed changes to properly make extensions work with new APIs and function names.

General Changes

  • [ ] Check for and remove usage of sessions. #458
  • [ ] Remove usage of any/all deprecated PM functions & filters.
  • [ ] Update PUM_Extension_Actication class from Exit Intent & the pum_extension_init function to check for $REQUIRED_CORE_VER
  • [ ] Update PUM_Extension_License to use self::$ID for EDD download ID.
  • [ ] Update Activator/Deactivator.
  • [ ] Add AssetCache Support.
  • [ ] Add autoloader support (below).

Add pum_autoloader support.

add_filter( 'pum_autoloaders', 'pum_ext_autoloader' );
function pum_ext_autoloader( $autoloaders = array() ) {
	return array_merge( $autoloaders, array(
		array(
			'prefix' => 'PUM_',
			'dir'    => dirname( __FILE__ ) . '/classes/',
		),
	) );
}

Update settings registration

  • [ ] Remove 'id' key if it matches the field index.
  • [ ] Move fields to tab sections rather than the tab itself $settings['tab']['section']['field_id']
  • [ ] Move from popmake_settings_extensions or popmake_registered_settings filters to pum_settings_fields
  • [ ] Change $field['name'] to $field['label']

Update popup settings & metaboxes.

  • [ ] Remove usage of popmake_popup_meta_field_groups meta storage.
  • [ ] Update Trigger & Cookie registration using new methods.
  • [ ] Replace usage of $popup->get_meta() with $popup->get_setting() where relevant.

Update Conditions processing.

  • [ ] Update fields options key and flip so that its value => label not reverse.

  • [ ] Move condition registration to new filter & move $condition['label']['name'] to top level key of $condition['name'] ( use the following regex search/replace in PHPStorm ): 'labels'.*\n.*'name'(.*)\n.* 'name'$1

  • [ ] Callbacks should update to use the following $condition input format, though backward compatibility layer has been added. Use the following 2 S&R $settings -> $condition $condition[ -> $condition['settings'][

$condition = array(
    'condition' => 'posts_selected',
    'not_operand' => false,
    'settings' => array(
        'selected' => array( 2, 4 ),
    ),
)

Update shortcode classes

  • [ ] Replace usage of _template() with template().
  • [ ] Replace usage of _template_styles() with template_styles().
  • [ ] Replace usage of sections() with tabs().
  • [ ] Add public $version = 2; variable.
  • [ ] Update post_types() return value.

Update upgrade routines.

Though most of this will be handled automatically these old names will be deprecated and removed.

pum_admin => pum_admin_vars

PUMModals => PUM_Admin.modals

danieliser avatar Dec 03 '17 18:12 danieliser

@danieliser Is this all valid and needed or has this changed in the last 2 years since this was opened?

fpcorso avatar Apr 30 '20 14:04 fpcorso

@fpcorso This is a "template" issue to be cloned for each extension. Many have been, some have not, so this may need to be copied to those that have not yet.

There is a sheet on docs Popup Maker / Extensions that includes a column showing whether they have been updated or not. If we clone it to the rest now we can close it here.

image

Now that hasn't been updated but we can manually check those that don't show as having been done yet.

danieliser avatar Apr 30 '20 17:04 danieliser