<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Inspira_Form_Admin_Settings_Fonts extends Engine_Form {

  public function init() {

    $settings = Engine_Api::_()->getApi('settings', 'core');

    $this->setTitle('Manage Fonts')
        ->setDescription('Here, you can configure the font settings for this theme on your website. You can also choose to enable the Google Fonts.');
            
    $googleFontArray = Engine_Api::_()->core()->getGoogleFonts('fontfamily');

    $this->addElement('Select', 'inspira_googlefonts', array(
      'label' => 'Choose Fonts',
      'description' => 'Choose from below the Fonts which you want to enable in this theme.',
      'multiOptions' => array(
        '0' => 'Web Safe Font Combinations',
        '1' => 'Google Fonts',
      ),
      'onchange' => "usegooglefont(this.value)",
      'value' => $settings->getSetting('inspira.googlefonts', 1),
    ));
    
    $font_array = array(
      'Georgia, serif' => 'Georgia, serif',
      '"Palatino Linotype", "Book Antiqua", Palatino, serif' => '"Palatino Linotype", "Book Antiqua", Palatino, serif',
      '"Times New Roman", Times, serif' => '"Times New Roman", Times, serif',
      'Arial, Helvetica, sans-serif' => 'Arial, Helvetica, sans-serif',
      '"Arial Black", Gadget, sans-serif' => '"Arial Black", Gadget, sans-serif',
      '"Comic Sans MS", cursive, sans-serif' => '"Comic Sans MS", cursive, sans-serif',
      'Impact, Charcoal, sans-serif' => 'Impact, Charcoal, sans-serif',
      '"Lucida Sans Unicode", "Lucida Grande", sans-serif' => '"Lucida Sans Unicode", "Lucida Grande", sans-serif',
      'Tahoma, Geneva, sans-serif' => 'Tahoma, Geneva, sans-serif',
      '"Trebuchet MS", Helvetica, sans-serif' => '"Trebuchet MS", Helvetica, sans-serif',
      'Verdana, Geneva, sans-serif' => 'Verdana, Geneva, sans-serif',
      '"Courier New", Courier, monospace' => '"Courier New", Courier, monospace',
      '"Lucida Console", Monaco, monospace' => '"Lucida Console", Monaco, monospace',
    );
    
    //Body Settings
    $this->addElement('Select', 'inspira_body_fontfamily', array(
      'label' => 'Body - Font Family',
      'description' => "Choose font family for the text under Body Styling.",
      'multiOptions' => $font_array,
      'value' => $settings->getSetting('inspira_body_fontfamily'),
    ));
    $this->getElement('inspira_body_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_body_fontfamily'), 'inspira_bodygrp', array('disableLoadDefaultDecorators' => true));
    $inspira_bodygrp = $this->getDisplayGroup('inspira_bodygrp');
    $inspira_bodygrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_bodygrp'))));

    //Google Font work
    $this->addElement('Select', 'inspira_googlebody_fontfamily', array(
      'label' => 'Body - Font Family',
      'description' => "Choose font family for the text under Body Styling.",
      'multiOptions' => $googleFontArray,
      'value' => $settings->getSetting('inspira_googlebody_fontfamily'),
    ));
    $this->getElement('inspira_googlebody_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_googlebody_fontfamily'), 'inspira_googlebodygrp', array('disableLoadDefaultDecorators' => true));
    $inspira_googlebodygrp = $this->getDisplayGroup('inspira_googlebodygrp');
    $inspira_googlebodygrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_googlebodygrp'))));
    

    //Heading Settings
    $this->addElement('Select', 'inspira_heading_fontfamily', array(
      'label' => 'Heading - Font Family',
      'description' => "Choose font family for the text under Heading Styling.",
      'multiOptions' => $font_array,
      'value' => $settings->getSetting('inspira_heading_fontfamily'),
    ));
    $this->getElement('inspira_heading_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_heading_fontfamily'), 'inspira_headinggrp', array('disableLoadDefaultDecorators' => true));
    $inspira_headinggrp = $this->getDisplayGroup('inspira_headinggrp');
    $inspira_headinggrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_headinggrp'))));
    
    
    //Google Font work
    $this->addElement('Select', 'inspira_googleheading_fontfamily', array(
      'label' => 'Heading - Font Family',
      'description' => "Choose font family for the text under Heading Styling.",
      'multiOptions' => $googleFontArray,
      'value' => $settings->getSetting('inspira_googleheading_fontfamily'),
    ));
    $this->getElement('inspira_googleheading_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_googleheading_fontfamily'), 'inspira_googleheadinggrp', array('disableLoadDefaultDecorators' => true));
    $inspira_googleheadinggrp = $this->getDisplayGroup('inspira_googleheadinggrp');
    $inspira_googleheadinggrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_googleheadinggrp'))));

    //Main Menu Settings
    $this->addElement('Select', 'inspira_mainmenu_fontfamily', array(
      'label' => 'Main Menu - Font Family',
      'description' => "Choose font family for the text under Main Menu Styling.",
      'multiOptions' => $font_array,
      'value' => $settings->getSetting('inspira_mainmenu_fontfamily'),
    ));
    $this->getElement('inspira_mainmenu_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_mainmenu_fontfamily'), 'inspira_mainmenugrp', array('disableLoadDefaultDecorators' => true));
    $inspira_mainmenugrp = $this->getDisplayGroup('inspira_mainmenugrp');
    $inspira_mainmenugrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_mainmenugrp'))));
    
    //Google Font work
    $this->addElement('Select', 'inspira_googlemainmenu_fontfamily', array(
      'label' => 'Main Menu - Font Family',
      'description' => "Choose font family for the text under Main Menu Styling.",
      'multiOptions' => $googleFontArray,
      'value' => $settings->getSetting('inspira_googlemainmenu_fontfamily'),
    ));
    $this->getElement('inspira_googlemainmenu_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false)); 
    
    $this->addDisplayGroup(array('inspira_googlemainmenu_fontfamily'), 'inspira_googlemainmenugrp', array('disableLoadDefaultDecorators' => true));
    $inspira_googlemainmenugrp = $this->getDisplayGroup('inspira_googlemainmenugrp');
    $inspira_googlemainmenugrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_googlemainmenugrp'))));
    

    //Tab Settings
    $this->addElement('Select', 'inspira_tab_fontfamily', array(
      'label' => 'Tab - Font Family',
      'description' => "Choose font family for the text under Tab Styling.",
      'multiOptions' => $font_array,
      'value' => $settings->getSetting('inspira_tab_fontfamily'),
    ));
    $this->getElement('inspira_tab_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_tab_fontfamily'), 'inspira_tabgrp', array('disableLoadDefaultDecorators' => true));
    $inspira_tabgrp = $this->getDisplayGroup('inspira_tabgrp');
    $inspira_tabgrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_tabgrp'))));
    
    
    //Google Font work
    $this->addElement('Select', 'inspira_googletab_fontfamily', array(
      'label' => 'Tab - Font Family',
      'description' => "Choose font family for the text under Tab Styling.",
      'multiOptions' => $googleFontArray,
      'value' => $settings->getSetting('inspira_googletab_fontfamily'),
    ));
    $this->getElement('inspira_googletab_fontfamily')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));
    
    $this->addDisplayGroup(array('inspira_googletab_fontfamily'), 'inspira_googletabgrp', array('disableLoadDefaultDecorators' => true));
    $inspira_googletabgrp = $this->getDisplayGroup('inspira_googletabgrp');
    $inspira_googletabgrp->setDecorators(array('FormElements', 'Fieldset', array('HtmlTag', array('tag' => 'div', 'id' => 'inspira_googletabgrp'))));

    
    // Add submit button
    $this->addElement('Button', 'submit', array(
        'label' => 'Save Changes',
        'type' => 'submit',
        'ignore' => true
    ));
  }
}
