Recent Topics

6.8.6 farbtastic color wheel not working in plugin settings or in widget settings

started by on Feb 14, 2017 – Last touched: Feb 26, 2017

Feb 14, 2017 22:08    

It seems to try and get it to work one would need to add:

/**
	 * Event handler: Called when ending the admin html head section.
	 *
	 * @see Plugin::AdminEndHtmlHead()
	 * @param array Associative array of parameters
	 * @return boolean did we do something?
	 */
	function AdminEndHtmlHead( & $params )
	{
		// Initialize farbastic colorpicker
		require_js( '#jquery#' );
		require_js( 'jquery/jquery.farbtastic.min.js' );
		require_css( 'jquery/farbtastic/farbtastic.css' );

		return true;
	}

Feb 19, 2017 01:12

Can you please post a screenshot of the bug in context? (otherwise we must guess how to reproduce it and won't be 100% sure to work on the correct issue)

Feb 19, 2017 12:05

Okay, to help understand and communicate this issue I include sample script:

New Plugin Script

<?php
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

//This plugin installs a widget that can be added to any widget container.
class sample_plugin extends Plugin
{
	var $name = 'Sample';
	var $code = 'evo_sample';
	var $priority = 50;
	var $version = '6.8.7';
	var $author = 'Sample';
	var $help_url = '';
	var $group = 'widget';
	var $number_of_installs = 1;
	var $is_tool = false;
	var $apply_when = 'never';
	
	function PluginInit( & $params )
	{
		$this->short_desc = T_('Sample plugin');
		$this->long_desc = T_('This plugin installs a widget');
	}

	//Get definitions for widget specific editable params
	function get_widget_param_definitions( $params )
	{
		$r = array(
					'input_color' => array(
						'label' => T_( 'Input Color' ),
						'size' => '25',
						'type' => 'color',
						'defaultvalue' => '',
						'note' => T_('Set input color'),
					),
							);			
		return $r;
	}

	function SkinTag( & $params )
	{
		echo $params['input_color'];
		return true;
	}
}

?>

Then add code to _sample.plugin.php and add file in plugins folder

Go to System > Plugins > Install plugin

Install sample plugin.

After install go to Collections > CollectionName > Widgets > Container > Add widget

The widget will open in Settings Edit mode

On entering the field "Sample Color" the color wheel should popup.

The color wheel does not open in either the Ajax Model or normal view.

Feb 19, 2017 12:17

The reason why the color wheel is not showing is because the JavaScript and CSS files does not appear in the <head> section in admin_view and neither in the "head" section of the Ajax model form.

Feb 26, 2017 15:30

@achillis Thank you for the detailed explanations. We will fix this asap.


Form is loading...

CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.