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

class Browserpush_Form_Admin_Settings_Fbsettings extends Engine_Form
{
  public function init()
  {
    $settings = Engine_Api::_()->getApi('settings', 'core');

    $description = vsprintf('This page contains Firebase API key settings. Below, enter the required key and code to get started with this plugin. To generate the keys, <a href="%1$s" target="_blank">click here</a>.<br />To read the tutorial on how to get API Key, read the <a href="%2$s" target="_blank">KB Article</a>.<br /><br /><b>Note:</b> Before configuring the API keys here, please make sure that you have given the write permission to the file "firebase-messaging-sw.js" on your website root directory path.', array('https://console.firebase.google.com/?pli=1', 'https://community.socialengine.com/blogs/1/157/how-can-i-configure-firebase-api-key-for-web-mobile-browser'));

    $this
      ->setTitle('Firebase API Key Settings')
      ->setDescription($description);
    // Decorators
    $this->loadDefaultDecorators();
	  $this->getDecorator('Description')->setOption('escape', false);
		$view = Zend_Registry::isRegistered('Zend_View') ? Zend_Registry::get('Zend_View') : null;

		$this->addElement('Textarea', "browserpush_serverkey", array(
			'label' => 'Configuration Object',
			'description' => 'Firebase configuration object containing keys and identifiers for your app.',
			'allowEmpty' => false,
			'required' => true,
			'value' => $settings->getSetting('browserpush.serverkey'),
		));
		$this->getElement('browserpush_serverkey')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));

    $this->addElement('Textarea', "browserpush_snippet", array(
		'label' => 'Firebase Private Key',
		'description' => 'Firebase Private Key will be used to send Push Notifications from your server. So, an Firebase Private API key will be required to enable this service. Here, enter the Firebase Private Key. If you are not sure what to enter, then please contact our support team.',
		'allowEmpty' => false,
		'required' => true,
		'value' => $settings->getSetting('browserpush.snippet'),
		));
		$this->getElement('browserpush_snippet')->getDecorator('Description')->setOptions(array('placement' => 'PREPEND', 'escape' => false));

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