LLMS_Meta_Box_Access::get_fields()
Define metabox fields
Return Return
(array)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.access.php
public function get_fields() {
$post_type = get_post_type_object( $this->post->post_type );
$restrictions = get_post_meta( $this->post->ID, $this->prefix . 'restricted_levels', true );
if ( ! $restrictions ) {
$restrictions = array();
}
return array(
array(
'title' => __( 'Membership Access', 'lifterlms' ),
'fields' => array(
array(
'controls' => '#' . $this->prefix . 'restricted_levels',
'desc_class' => 'd-1of2 t-1of2 m-1of2',
'id' => $this->prefix . 'is_restricted',
'label' => sprintf( _x( 'Restrict this %s', 'apply membership restriction to post type', 'lifterlms' ), $post_type->labels->singular_name ),
'type' => 'checkbox',
'value' => 'yes',
),
array(
'class' => 'input-full llms-select2-post',
'data_attributes' => array(
'post-type' => 'llms_membership',
),
'desc' => sprintf( __( 'Visitors must belong to one of these memberships to access this %s', 'lifterlms' ), strtolower( $post_type->labels->singular_name ) ),
'id' => $this->prefix . 'restricted_levels',
'label' => __( 'Memberships', 'lifterlms' ),
'multi' => true,
'type' => 'select',
'value' => llms_make_select2_post_array( $restrictions ),
),
),
),
);
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |