-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from ryanwelcher/feature/deprecate-controls-fo…
…r-gb-1 Deprecate controls that were merged into Gutenberg 19
- Loading branch information
Showing
7 changed files
with
117 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Handles enqueueing of assets for the plugin. | ||
* | ||
* @package AdvancedQueryLoop/Utils | ||
*/ | ||
|
||
namespace AdvancedQueryLoop\Utils; | ||
|
||
/** | ||
* Helper to determine if the Gutenberg plugin is installed and if so, if it is at or higher a given version. | ||
* | ||
* @param string $version The version to check for. | ||
* | ||
* @return boolean. | ||
*/ | ||
function is_gutenberg_plugin_version_or_higher( string $version ) { | ||
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && defined( 'GUTENBERG_VERSION' ) ) { | ||
// This means the plugin is installed | ||
return version_compare( GUTENBERG_VERSION, $version, '>=' ); | ||
} | ||
return false; | ||
} | ||
|
||
/** | ||
* Helper to determine is the current WP install is at or higher than a given version. | ||
* | ||
* @param string $version The version to check for. | ||
* @return boolean. | ||
*/ | ||
function is_core_version_or_higher( string $version ) { | ||
$core = get_bloginfo( 'version' ); | ||
return version_compare( $core, $version, '>=' ); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { registerPlugin } from '@wordpress/plugins'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import AQLLegacyControls from '../slots/aql-legacy-controls'; | ||
import { PostCountControls } from '../components/post-count-controls'; | ||
import { PostOffsetControls } from '../components/post-offset-controls'; | ||
|
||
registerPlugin( 'aql-pre-gb-19-controls', { | ||
render: () => { | ||
return ( | ||
<> | ||
<AQLLegacyControls> | ||
{ ( props ) => ( | ||
<> | ||
<PostCountControls { ...props } /> | ||
<PostOffsetControls { ...props } /> | ||
</> | ||
) } | ||
</AQLLegacyControls> | ||
</> | ||
); | ||
}, | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill } from '@wordpress/components'; | ||
|
||
/** | ||
* Create our Slot and Fill components | ||
*/ | ||
const { Fill, Slot } = createSlotFill( 'AQLLegacyControls' ); | ||
|
||
/** | ||
* This slot is not exposed and is used to try to maintain the same UI | ||
*/ | ||
|
||
const AQLLegacyControls = ( { children } ) => <Fill>{ children }</Fill>; | ||
|
||
AQLLegacyControls.Slot = ( { fillProps } ) => ( | ||
<Slot fillProps={ fillProps }> | ||
{ ( fills ) => { | ||
return fills.length ? fills : null; | ||
} } | ||
</Slot> | ||
); | ||
|
||
export default AQLLegacyControls; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters