Example #1
0
/**
 * Meta box form.
 * 
 * @param type $field
 * @return string 
 */
function wpcf_fields_colorpicker_meta_box_form($field)
{
    $form = array();
    $form['name'] = array('#type' => 'textfield', '#name' => 'wpcf[' . $field['slug'] . ']', '#attributes' => array('class' => 'js-types-colorpicker', 'style' => 'width:100px;'), '#after' => '');
    wpcf_fields_colorpicker_enqueue_scripts();
    //By Gen: changed minimal version from 3.4 to 3.5, because colorbox not works in 3.4.2
    if (wpcf_compare_wp_version('3.5', '<')) {
        $form['name']['#after'] .= '<a href="#" class="button-secondary js-types-pickcolor">' . __('Pick color', 'wpcf') . '</a><div class="js-types-cp-preview types-cp-preview" style="background-color:' . $field['value'] . '"></div>';
        wp_enqueue_script('farbtastic');
        wp_enqueue_style('farbtastic');
    } else {
        wp_enqueue_script('wp-color-picker');
        wp_enqueue_style('wp-color-picker');
        if (defined('DOING_AJAX')) {
            $form['name']['#after'] .= '<script type="text/javascript">typesPickColor.init();</script>';
        }
    }
    return $form;
}
_e('Crop images, so that they fill the specified dimensions exactly.', 'wpcf');
?>
</label>
        </p>
    </div>
</div>

<p class="form-inline">
	<input id="image-url" type="checkbox" name="url" value="1" data-bind="checked: imageUrl, click: imageUrlDisable" />
	<label for="image-url"><?php 
_e('Output only the URL of the re-sized image instead of the img tag', 'wpcf');
?>
</label>
</p>

<!--<input id="image-onload" type="text" name="onload" value="<?php 
echo $data['onload'];
?>
" />
<label for="image-onload"><?php 
_e('Onload callback', 'wpcf');
?>
</label>-->


</script><!--END TYPES MODAL IMAGE-->

<?php 
WPCF_Loader::loadInclude('fields/colorpicker');
wpcf_fields_colorpicker_enqueue_scripts();
wpcf_fields_colorpicker_render_js();