Exemplo n.º 1
0
 /**
  * Tests the chosen method.
  *
  * @return  void
  *
  * @since   3.1
  */
 public function testChosen()
 {
     // Initialise the chosen script
     JHtmlFormbehavior::chosen('testSelect');
     // Get the document instance
     $document = JFactory::getDocument();
     $this->assertArrayHasKey('/media/jui/js/jquery.min.js', $document->_scripts, 'Verify that the chosen method initialises jQuery as well');
     $this->assertArrayHasKey('/media/jui/js/chosen.jquery.min.js', $document->_scripts, 'Verify that the Chosen JS is loaded');
     $this->assertArrayHasKey('/media/jui/css/chosen.css', $document->_styleSheets, 'Verify that the Chosen CSS is loaded');
     $this->assertContains("jQuery('testSelect').chosen", $document->_script['text/javascript'], 'Verify that the Chosen JS is initialised with the supplied selector');
 }
Exemplo n.º 2
0
 function build()
 {
     //Chosen should not be used
     if (!$this->useFramework('chosen')) {
         return;
     }
     //Chosen is already in the core since Joomla 3.0. Load it from the class.
     if ($this->jVersion('3.0')) {
         JHtmlFormbehavior::chosen();
         return;
     }
     JDom::_('framework.jquery.ui');
     // Add chosen.jquery.js language strings
     JText::script('JGLOBAL_SELECT_SOME_OPTIONS');
     JText::script('JGLOBAL_SELECT_AN_OPTION');
     JText::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
     $this->attachJs[] = 'chosen.jquery.min.js';
     $this->attachCss[] = 'chosen.css';
 }
Exemplo n.º 3
0
<?php

/**
 * Part of Component {{extension.name.cap}} files.
 *
 * @copyright   Copyright (C) 2016 {ORGANIZATION}. All rights reserved.
 * @license     GNU General Public License version 2 or later.
 */
// No direct access
defined('_JEXEC') or die;
JHtmlBootstrap::tooltip();
JHtmlFormbehavior::chosen('select');
JHtmlBehavior::formvalidator();
/**
 * Prepare data for this template.
 *
 * @var $this      \Windwalker\View\Engine\PhpEngine
 * @var $container \Windwalker\DI\Container
 * @var $data      \Windwalker\Data\Data
 * @var $item      \stdClass
 */
$container = $this->getContainer();
$form = $data->form;
$item = $data->item;
// Setting tabset
$tabs = array('tab_basic');
?>
<!-- Validate Script -->
<script type="text/javascript">
	Joomla.submitbutton = function(task)
	{
Exemplo n.º 4
0
 /**
  * @param   JForm $form The form to be altered.
  * @param   array $data The associated data for the form.
  *
  * @return  boolean
  */
 public function onContentPrepareForm($form, $data)
 {
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, $this->allow_context)) {
         return true;
     }
     // Include UserXTD core API.
     $this->initComponent();
     $result = null;
     $UXParams = JComponentHelper::getParams('com_userxtd');
     // Prepare Data
     // ============================================================================
     // Set Chosen
     JHtmlFormbehavior::chosen('select');
     // Prepare Form
     // ============================================================================
     // Get Form
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Hide some fields in registration
     $context = $this->getContext();
     $array = array();
     $reg_context = array('com_users.registration', 'com_userxtd.registration');
     $profile_context = array('com_users.profile');
     $catid = null;
     if (in_array($context, $reg_context) || $this->get('hide_registration_field')) {
         $array['hide_in_registration'] = true;
         $catid = $UXParams->get('CoreRegistration_Categories', array('*'));
     } elseif (in_array($context, $profile_context)) {
         $catid = $UXParams->get('CoreRegistration_Categories_InUserInfo', array('*'));
     }
     // Set category
     if (!is_array($catid)) {
         $catid = array($catid);
     }
     if (!in_array('*', $catid)) {
         $catid = implode(',', $catid);
     } else {
         $catid = null;
     }
     $form = \Userxtd\Form\FormHelper::getFieldsByCategory($catid, $form, $array);
     return $result;
 }