__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace CarouselSlider\Supports\FormFields;
use CarouselSlider\Helper;
/**
* ButtonGroup class
*/
class ButtonGroup extends BaseField {
/**
* Render field html
*
* @inheritDoc
*/
public function render(): string {
$value = $this->get_value();
$name = $this->get_name();
$html = '<div id="' . esc_attr( $this->get_setting( 'id' ) ) . '" class="buttonset">';
foreach ( $this->get_setting( 'choices' ) as $key => $choice ) {
if ( ! is_array( $choice ) ) {
$choice = [
'value' => $key,
'label' => $choice,
];
}
$is_pro_only = isset( $choice['pro_only'] ) && $choice['pro_only'];
if ( $is_pro_only && Helper::show_pro_features() === false ) {
continue;
}
if ( $is_pro_only && ! Helper::is_pro_active() ) {
$name = sprintf( 'need_pro_%s', $name );
}
$id = sprintf( '%s-%s', $this->get_setting( 'id' ), $choice['value'] );
$label_class = sprintf( 'switch-label switch-label-%s', ( $choice['value'] === $value ) ? 'on' : 'off' );
$radio_attr = [
'type' => 'radio',
'name' => $name,
'id' => $id,
'class' => 'switch-input screen-reader-text',
'value' => $choice['value'],
'checked' => $choice['value'] === $value,
];
if (
( isset( $choice['disabled'] ) && $choice['disabled'] ) ||
( $is_pro_only && ! Helper::is_pro_active() )
) {
$radio_attr['disabled'] = true;
}
if ( $is_pro_only ) {
$label_class .= ' has-pro-tag';
$label = esc_html( $choice['label'] ) . '<span class="pro-only">' . esc_html__( 'pro', 'carousel-slider' ) . '</span>';
} else {
$label = esc_html( $choice['label'] );
}
$html .= '<input ' . $this->array_to_attributes( $radio_attr ) . ' />';
$html .= '<label class="' . esc_attr( $label_class ) . '" for="' . esc_attr( $id ) . '">' . $label . '</label>';
}
$html .= '</div>';
return $html;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| BaseField.php | File | 5.86 KB | 0775 |
|
| Breakpoint.php | File | 3.36 KB | 0775 |
|
| ButtonGroup.php | File | 1.86 KB | 0775 |
|
| Checkbox.php | File | 882 B | 0775 |
|
| CheckboxSwitch.php | File | 887 B | 0775 |
|
| Color.php | File | 636 B | 0775 |
|
| DataSharing.php | File | 1.53 KB | 0775 |
|
| Html.php | File | 310 B | 0775 |
|
| ImageUploader.php | File | 1.06 KB | 0775 |
|
| ImageUrl.php | File | 762 B | 0775 |
|
| ImagesGallery.php | File | 1.49 KB | 0775 |
|
| MultiCheckbox.php | File | 1.3 KB | 0775 |
|
| Radio.php | File | 1.41 KB | 0775 |
|
| ResponsiveControl.php | File | 5.26 KB | 0775 |
|
| Select.php | File | 1.31 KB | 0775 |
|
| SelectImageSize.php | File | 347 B | 0775 |
|
| SelectPosts.php | File | 633 B | 0775 |
|
| SelectTerms.php | File | 633 B | 0775 |
|
| Spacing.php | File | 1.18 KB | 0775 |
|
| Text.php | File | 257 B | 0775 |
|
| Textarea.php | File | 524 B | 0775 |
|