name : dearflipcat.php
<?php


/**
 
 * @package     pkg_dearflip
 * @subpackage  com_dearflip
 * @since       1.0.0
 * @copyright   Copyright © 2007 Free Software Foundation, Inc. All rights reserved.
 * @license   GNU General Public License version 3 or later; see https://www.gnu.org/licenses/gpl-3.0.en.html
 
 */

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

JFormHelper::loadFieldClass( 'list' );

/**
 * Dearflipcat Form Field class for the Dearflip component
 *
 * @since  0.0.1
 */
class JFormFieldDearflipcat extends JFormFieldList {
  /**
   * The field type.
   *
   * @var         string
   */
  protected $type = 'Dearflipcat';
  
  /**
   * Method to get a list of options for a list input.
   *
   * @return  array  An array of JHtml options.
   */
  protected function getOptions() {
    $db    = JFactory::getDBO();
    $query = $db->getQuery( true );
    $query->select( 'id,cat_title', 'dfx_cat_description', 'dfx_cat_view_mode',
        'dfx_cat_button_text_type',
          'published'
        );
    
    $query->from( '#__dearflipcat' );
    $db->setQuery( (string)$query );
    $messages = $db->loadObjectList();
    $options  = array();
    
    if ( $messages ) {
      foreach ( $messages as $message ) {
        $options[] = JHtml::_( 'select.option', $message->id, $message->cat_title);
      }
    }
    
    $options = array_merge( parent::getOptions(), $options );
    
    return $options;
  }
}

© 2025 Cubjrnet7