function getCascadedField()
 {
     $field_id = JRequest::getInt('field_id', 0);
     $item_id = JRequest::getInt('item_id', 0);
     $valgrps = JRequest::getVar('valgrps', '');
     $valindex = JRequest::getVar('valindex', 0);
     // Load field
     $_fields = FlexicontentFields::getFieldsByIds(array($field_id), array($item_id));
     $field = $_fields[$field_id];
     $field->item_id = $item_id;
     $field->valgrps = $valgrps;
     $field->valindex = $valindex;
     // Load item
     $item = JTable::getInstance($_type = 'flexicontent_items', $_prefix = '', $_config = array());
     $item->load($item_id);
     // Get field configuration
     FlexicontentFields::loadFieldConfig($field, $item);
     // Get field values
     //$_fieldvalues = FlexicontentFields::getFieldValsById(array($field_id), array($item_id));
     $field->value = null;
     //isset($_fieldvalues[$item_id][$field_id]) ? $_fieldvalues[$item_id][$field_id] : array();
     // Render field
     $field->isAjax = 1;
     $this->onDisplayField($field, $item);
     // Output the field
     echo $field->html;
     exit;
 }
 static function ordery_selector(&$params, $formname = 'adminForm', $autosubmit = 1, $extra_order_types = array(), $sfx = '')
 {
     if (!$params->get('orderby_override' . $sfx, 0)) {
         return '';
     }
     $app = JFactory::getApplication();
     //$orderby = $app->getUserStateFromRequest( $option.'.category'.$category->id.'.filter_order_Dir', 'filter_order', 'i.title', 'string' );
     $orderby = $app->getUserStateFromRequest('orderby', 'orderby', '', 'string');
     flexicontent_html::loadFramework('select2');
     $classes = "fc_field_filter use_select2_lib";
     $onchange = !$autosubmit ? '' : ' onchange="adminFormPrepare(this.form, 2);" ';
     $attribs = ' class="' . $classes . '" ' . $onchange;
     $orderby_options = $params->get('orderby_options' . $sfx, array('_preconfigured_', 'date', 'rdate', 'modified', 'alpha', 'ralpha', 'author', 'rauthor', 'hits', 'rhits', 'id', 'rid', 'order'));
     $orderby_options = FLEXIUtilities::paramToArray($orderby_options);
     $orderby_names = array('_preconfigured_' => 'FLEXI_ORDER_DEFAULT_INITIAL', 'date' => 'FLEXI_ORDER_OLDEST_FIRST', 'rdate' => 'FLEXI_ORDER_MOST_RECENT_FIRST', 'modified' => 'FLEXI_ORDER_LAST_MODIFIED_FIRST', 'published' => 'FLEXI_ORDER_RECENTLY_PUBLISHED_FIRST', 'alpha' => 'FLEXI_ORDER_TITLE_ALPHABETICAL', 'ralpha' => 'FLEXI_ORDER_TITLE_ALPHABETICAL_REVERSE', 'author' => 'FLEXI_ORDER_AUTHOR_ALPHABETICAL', 'rauthor' => 'FLEXI_ORDER_AUTHOR_ALPHABETICAL_REVERSE', 'hits' => 'FLEXI_ORDER_MOST_HITS', 'rhits' => 'FLEXI_ORDER_LEAST_HITS', 'id' => 'FLEXI_ORDER_HIGHEST_ITEM_ID', 'rid' => 'FLEXI_ORDER_LOWEST_ITEM_ID', 'commented' => 'FLEXI_ORDER_MOST_COMMENTED', 'rated' => 'FLEXI_ORDER_BEST_RATED', 'order' => 'FLEXI_ORDER_CONFIGURED_ORDER');
     $ordering = array();
     foreach ($extra_order_types as $value => $text) {
         $text = JText::_($text);
         $ordering[] = JHTML::_('select.option', $value, $text);
     }
     foreach ($orderby_options as $orderby_option) {
         if ($orderby_option == '__SAVED__') {
             continue;
         }
         $value = $orderby_option != '_preconfigured_' ? $orderby_option : '';
         $text = JText::_($orderby_names[$orderby_option]);
         $ordering[] = JHTML::_('select.option', $value, $text);
     }
     // Add custom field orderings
     $orderby_custom = $params->get('orderby_custom' . $sfx, '');
     $orderby_custom = preg_split("/\\s*,\\s*/u", $orderby_custom);
     $field_ids = array();
     $custom_ops = array();
     $n = 0;
     foreach ($orderby_custom as $custom_option) {
         $order_parts = preg_split("/:/", $custom_option);
         if (count($order_parts) != 3 && count($order_parts) != 4) {
             continue;
         }
         $_field_id = (int) @$order_parts[0];
         if (!$_field_id) {
             continue;
         }
         $field_ids[$_field_id] = 1;
         $custom_ops[$n] = $order_parts;
         $n++;
     }
     $fields = FlexicontentFields::getFieldsByIds(array_keys($field_ids));
     foreach ($custom_ops as $op) {
         $field_id = $op[0];
         $field = $fields[$field_id];
         $value = 'custom:' . $op[0] . ':' . $op[1] . ':' . $op[2];
         if (count($op) == 4) {
             $text = JText::_($op[3]);
         } else {
             $text = JText::_($field->label) . ' ' . JText::_(strtolower($op[2]) == 'asc' ? 'FLEXI_INCREASING' : 'FLEXI_DECREASING');
         }
         $ordering[] = JHTML::_('select.option', $value, $text);
     }
     return JHTML::_('select.genericlist', $ordering, 'orderby', $attribs, 'value', 'text', $orderby);
 }