diff --git a/wp-content/plugins/wporg-learn/inc/post-meta.php b/wp-content/plugins/wporg-learn/inc/post-meta.php
index 2421c75a0..74e22c44d 100644
--- a/wp-content/plugins/wporg-learn/inc/post-meta.php
+++ b/wp-content/plugins/wporg-learn/inc/post-meta.php
@@ -27,11 +27,32 @@
* Register all post meta keys.
*/
function register() {
+ register_lesson_meta();
register_lesson_plan_meta();
register_workshop_meta();
register_misc_meta();
}
+/**
+ * Register post meta keys for lessons.
+ */
+function register_lesson_meta() {
+ register_post_meta(
+ 'lesson',
+ '_lesson_featured',
+ array(
+ 'description' => __( 'Whether the lesson is featured.', 'wporg-learn' ),
+ 'type' => 'string',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ 'show_in_rest' => true,
+ 'auth_callback' => function( $allowed, $meta_key, $post_id ) {
+ return current_user_can( 'edit_post', $post_id );
+ },
+ ),
+ );
+}
+
/**
* Register post meta keys for lesson plans.
*/
@@ -613,6 +634,7 @@ function render_locales_list() {
function enqueue_editor_assets() {
enqueue_expiration_date_assets();
enqueue_language_meta_assets();
+ enqueue_lesson_featured_meta_assets();
enqueue_duration_meta_assets();
}
@@ -669,6 +691,31 @@ function enqueue_language_meta_assets() {
}
}
+/**
+ * Enqueue scripts for the featured lesson meta block.
+ */
+function enqueue_lesson_featured_meta_assets() {
+ global $typenow;
+
+ if ( 'lesson' === $typenow ) {
+ $script_asset_path = get_build_path() . 'lesson-featured-meta.asset.php';
+ if ( ! file_exists( $script_asset_path ) ) {
+ wp_die( 'You need to run `yarn start` or `yarn build` to build the required assets.' );
+ }
+
+ $script_asset = require( $script_asset_path );
+ wp_enqueue_script(
+ 'wporg-learn-lesson-featured-meta',
+ get_build_url() . 'lesson-featured-meta.js',
+ $script_asset['dependencies'],
+ $script_asset['version'],
+ true
+ );
+
+ wp_set_script_translations( 'wporg-learn-lesson-featured-meta', 'wporg-learn' );
+ }
+}
+
/**
* Enqueue scripts for the duration meta block.
*/
diff --git a/wp-content/plugins/wporg-learn/js/lesson-featured-meta/index.js b/wp-content/plugins/wporg-learn/js/lesson-featured-meta/index.js
new file mode 100644
index 000000000..d0c178140
--- /dev/null
+++ b/wp-content/plugins/wporg-learn/js/lesson-featured-meta/index.js
@@ -0,0 +1,42 @@
+/**
+ * WordPress dependencies
+ */
+import { CheckboxControl, PanelRow } from '@wordpress/components';
+import { useDispatch, useSelect } from '@wordpress/data';
+import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
+import { useState } from '@wordpress/element';
+import { __ } from '@wordpress/i18n';
+import { registerPlugin } from '@wordpress/plugins';
+
+const FEATURED = 'featured';
+
+const LessonFeaturedMeta = () => {
+ const postMetaData = useSelect( ( select ) => select( 'core/editor' ).getEditedPostAttribute( 'meta' ) || {} );
+ const { editPost } = useDispatch( 'core/editor' );
+ const [ lessonFeatured, setLessonFeatured ] = useState( postMetaData?._lesson_featured === FEATURED );
+
+ return (
+