LLMS_Blocks_Course_Information_Block::add_hooks( array $attributes = array(), string $content = '' )

Add actions attached to the render function action.


Parameters Parameters

$attributes

(array) (Optional) Block attributes.

Default value: array()

$content

(string) (Optional) Block content.

Default value: ''


Top ↑

Return Return

(void)


Top ↑

Source Source

File: libraries/lifterlms-blocks/includes/blocks/class-llms-blocks-course-information-block.php

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
*
 * @var string
 */
public $title_size;
 
/**
 * Add actions attached to the render function action.
 *
 * @param   array  $attributes Optional. Block attributes. Default empty array.
 * @param   string $content    Optional. Block content. Default empty string.
 * @return  void
 * @since   1.0.0
 * @version 1.1.0
 */
public function add_hooks( $attributes = array(), $content = '' ) {
 
    $attributes = wp_parse_args(
        $attributes,
        array(
            'title'           => __( 'Course Information', 'lifterlms' ),
            'title_size'      => 'h3',
            'show_length'     => true,
            'show_difficulty' => true,
            'show_tracks'     => true,
            'show_cats'       => true,
            'show_tags'       => true,
        )
    );
 
    $show_wrappers = false;
 
    if ( $attributes['show_length'] ) {
        $show_wrappers = true;
        add_action( $this->get_render_hook(), 'lifterlms_template_single_length', 10 );
    }
 
    if ( $attributes['show_difficulty'] ) {
        $show_wrappers = true;
        add_action( $this->get_render_hook(), 'lifterlms_template_single_difficulty', 20 );
    }
 
    if ( $attributes['show_tracks'] ) {
        $show_wrappers = true;
        add_action( $this->get_render_hook(), 'lifterlms_template_single_course_tracks', 25 );
    }
 
    if ( $attributes['show_cats'] ) {
        $show_wrappers = true;
        add_action( $this->get_render_hook(), 'lifterlms_template_single_course_categories', 30 );
    }
 
    if ( $attributes['show_tags'] ) {
        $show_wrappers = true;
        add_action( $this->get_render_hook(), 'lifterlms_template_single_course_tags', 35 );
    }

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.