/**
 * Get builder item widths for using in js (wp_localize_script() or json_encode())
 *
 * @param string $builder_type Builder option type (some builders can have different item widths)
 * @return array
 */
function fw_ext_builder_get_item_widths_for_js($builder_type)
{
    $item_widths = array();
    foreach (fw_ext_builder_get_item_width($builder_type) as $width_id => $width_data) {
        $width_data['id'] = $width_id;
        $item_widths[] = $width_data;
    }
    return $item_widths;
}
Exemple #2
0
if (!defined('FW')) {
    die('Forbidden');
}
/**
 * @var array $item
 * @var string $type
 * @var array $attr
 * @var int $max_width
 */
$options = $item['options'];
$choice_options = $item['options']['wrong-answers'];
$choice_options = array_merge($choice_options, $item['options']['correct-answers']);
shuffle($choice_options);
?>
<div class="<?php 
echo esc_attr(fw_ext_builder_get_item_width('quiz-builder', $item['width'] . '/frontend_class'));
?>
">
	<div class="field-checkbox input-styled">
		<label><?php 
echo $item['number'] . ') ' . fw_htmlspecialchars($item['options']['question']);
?>
</label>

		<div class="custom-checkbox">
			<?php 
$counter = 1;
foreach ($choice_options as $option) {
    ?>
				<div class="options">
					<input type="checkbox" value="<?php 
 public function get_shortcode_data($atts = array())
 {
     $default_width = fw_ext_builder_get_item_width($this->get_builder_type());
     end($default_width);
     // move to the last width (usually it's the biggest)
     $default_width = key($default_width);
     $return_atts = array('width' => $atts['width'] ? $atts['width'] : $default_width);
     if (isset($atts['atts'])) {
         $return_atts = array_merge($return_atts, $atts['atts']);
     }
     return array('tag' => $this->get_type(), 'atts' => $return_atts);
 }
<?php

if (!defined('FW')) {
    die('Forbidden');
}
$class = fw_ext_builder_get_item_width('page-builder', $atts['width'] . '/frontend_class');
if (!empty($atts['extraclasses'])) {
    $extraclass = $atts['extraclasses'];
} else {
    $extraclass = "";
}
?>
<div class="<?php 
echo $class;
?>
 <?php 
echo $extraclass;
?>
">
	<?php 
echo do_shortcode($content);
?>
</div>