Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed use of deprecated filter with the Divi Theme #44

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelogs/divi-quiz-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
significance: minor
type: deprecated
entry: Deprecated method `LLMS_Lab_Lifti::quiz_settings`.
6 changes: 6 additions & 0 deletions .changelogs/divi-quiz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
significance: patch
type: fixed
links:
- "#16"
entry: Fix use of deprecated filter `llms_get_quiz_theme_settings` with the Divi
Theme Compatibility lab (aka Lifti).
12 changes: 6 additions & 6 deletions inc/labs/class.llms.lab.action.manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,32 +265,32 @@ public function setup_hooks() {
array(
'title' => esc_html__( 'Course and Membership Catalogs', 'lifterlms-labs' ),
'actions' => array(
'lifterlms_loop_featured_video' => array(
'lifterlms_loop_featured_video' => array(
'action' => 'lifterlms_before_loop_item',
'priority' => 8,
'title' => esc_html__( 'Featured Video', 'lifterlms-labs' ),
),
'lifterlms_template_loop_thumbnail' => array(
'lifterlms_template_loop_thumbnail' => array(
'action' => 'lifterlms_before_loop_item_title',
'priority' => 10,
'title' => esc_html__( 'Featured Image', 'lifterlms-labs' ),
),
'lifterlms_template_loop_progress' => array(
'lifterlms_template_loop_progress' => array(
'action' => 'lifterlms_before_loop_item_title',
'priority' => 15,
'title' => esc_html__( 'Progress Bar', 'lifterlms-labs' ),
),
'lifterlms_template_loop_author' => array(
'lifterlms_template_loop_author' => array(
'action' => 'lifterlms_after_loop_item_title',
'priority' => 10,
'title' => esc_html__( 'Author', 'lifterlms-labs' ),
),
'lifterlms_template_loop_length' => array(
'lifterlms_template_loop_length' => array(
'action' => 'lifterlms_after_loop_item_title',
'priority' => 15,
'title' => esc_html__( 'Length', 'lifterlms-labs' ),
),
'lifterlms_template_loop_difficulty' => array(
'lifterlms_template_loop_difficulty' => array(
'action' => 'lifterlms_after_loop_item_title',
'priority' => 20,
'title' => esc_html__( 'Difficulty', 'lifterlms-labs' ),
Expand Down
48 changes: 42 additions & 6 deletions inc/labs/class.llms.lab.lifti.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

defined( 'ABSPATH' ) || exit;

defined( 'ABSPATH' ) || exit;

/**
* Lab: Lifti.
*
Expand Down Expand Up @@ -62,6 +60,7 @@ protected function configure() {
*
* @since 1.1.0
* @since 1.5.1 Unknown.
* @since [version] Replace use of deprecated `llms_get_quiz_theme_settings`.
*
* @return void
*/
Expand Down Expand Up @@ -96,10 +95,7 @@ protected function init() {

add_action( 'add_meta_boxes', array( $this, 'add_page_settings' ) );

if ( ! get_theme_support( 'lifterlms-quizzes' ) ) {
add_theme_support( 'lifterlms-quizzes' );
add_filter( 'llms_get_quiz_theme_settings', array( $this, 'quiz_settings' ) );
}
add_filter( 'llms_builder_register_custom_fields', array( $this, 'add_builder_quiz_settings' ) );

}

Expand Down Expand Up @@ -450,17 +446,57 @@ public function output_content_wrapper_end() {
</div> <!-- #main-content -->';
}

/**
* Add quiz sidebar layout compatibility options to Divi.
*
* @since [version]
*
* @param array $builder_fields Builder fields.
* @return array
*/
public function add_builder_quiz_settings( $builder_fields ) {

if ( ! isset( $builder_fields['quiz'] ) ) {
$builder_fields['quiz'] = array();
}

$builder_fields['quiz']['layout'] = array(
'title' => esc_html__( 'Divi Theme Settings', 'lifterlms-labs' ),
'toggleable' => true,
'fields' => array(
array(
array(
'attribute' => 'et_pb_page_layout',
'attribute_prefix' => '_',
'label' => esc_html__( 'Layout', 'lifterlms-labs' ),
'options' => array(
'et_full_width_page' => esc_html__( 'Fullwidth', 'lifterlms-labs' ),
'et_left_sidebar' => esc_html__( 'Left Sidebar', 'lifterlms-labs' ),
'et_right_sidebar' => esc_html__( 'Right Sidebar', 'lifterlms-labs' ),
),
'type' => 'select',
),
),
),
);
return $builder_fields;
}

/**
* Add quiz sidebar layout compatibility options to Divi.
*
* @since 1.5.1
* @since [version] Escaped strings.
*
* @deprecated [version]
*
* @param array $settings Quiz settings array.
* @return array
*/
public function quiz_settings( $settings ) {

llms_deprecated_function( __METHOD__, '[version]' );

$settings['layout'] = array(
'id' => 'et_pb_page_layout',
'id_prefix' => '_',
Expand Down
Loading