LLMS_Metabox_Field::output()
Outputs the head for each of the field types.
Return Return
(void)
Source Source
File: includes/admin/post-types/meta-boxes/fields/llms.class.meta.box.fields.php
public function output() {
global $post;
if ( isset( $this->field['meta'] ) ) {
$this->meta = $this->field['meta'];
} elseif ( ( ! metadata_exists( 'post', $post->ID, $this->field['id'] ) || 'auto-draft' === $post->post_status ) && ! empty( $this->field['default'] ) ) {
$this->meta = $this->field['default'];
} else {
$this->meta = self::get_post_meta( $post->ID, $this->field['id'] );
}
if ( ! isset( $this->field['group'] ) ) {
$this->field['group'] = '';
}
if ( ! isset( $this->field['desc_class'] ) ) {
$this->field['desc_class'] = '';
}
if ( ! isset( $this->field['desc'] ) ) {
$this->field['desc'] = '';
}
$wrapper_classes = array( 'llms-mb-list' );
$wrapper_classes[] = $this->field['id'];
$wrapper_classes[] = $this->field['type'];
$wrapper_classes = array_merge( $wrapper_classes, explode( ' ', $this->field['group'] ) );
?>
<li
class="<?php echo esc_attr( implode( ' ', $wrapper_classes ) ); ?>"
<?php
echo isset( $this->field['controller'] ) ? ' data-controller="' . esc_attr( $this->field['controller'] ) . '"' : '';
echo isset( $this->field['controller_value'] ) ? ' data-controller-value="' . esc_attr( $this->field['controller_value'] ) . '"' : '';
?>
>
<?php if ( ! empty( $this->field['desc'] ) || ! empty( $this->field['label'] ) ) : ?>
<div class="description <?php echo esc_attr( $this->field['desc_class'] ); ?>">
<?php if ( ! empty( $this->field['label'] ) ) : ?>
<label for="<?php echo esc_attr( $this->field['id'] ); ?>"><?php echo esc_html( $this->field['label'] ); ?></label>
<?php endif; ?>
<?php echo wp_kses_post( $this->field['desc'] ); ?>
<?php
if ( isset( $this->field['required'] ) && $this->field['required'] ) :
?>
<em>(required)</em><?php endif; ?>
</div>
<?php
endif;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| unknown | unknown |
| 6.0.0 | Do not print empty labels; do not print the description block if both 'desc' and 'label' are empty.<br> Avoid retrieving the meta from the db if passed. |
| 3.11.0 | Introduced. |