Files
redline.com.pl/modules/steasyvideo/controllers/admin/AdminStEasyVideoSettingController.php
Jacek Pyziak eacf500d18 feat: Add YouTube video support and update admin templates
- Introduced a new YouTube tech integration in `youtube.min.js` for enhanced video playback.
- Created new admin template files for managing video settings, including `index.php` and `steasyvideo-pro.tpl`.
- Updated hook templates (`device_mode.tpl`, `forquickview.tpl`, `header.tpl`, `miniature.tpl`, `miniature_tb.tpl`, and predefined templates) to include video functionality.
- Implemented caching headers in several PHP files to improve performance.
- Ensured all new templates include proper licensing information and copyright notices.
2025-05-23 19:27:41 +02:00

189 lines
8.7 KiB
PHP

<?php
/**
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminStEasyVideoSettingController extends ModuleAdminController
{
public function __construct()
{
$this->bootstrap = true;
parent::__construct();
$this->fields_options = array(
'general' => array(
'title' => $this->l('General Settings'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'THEME_NAME' => array(
'type' => 'radio',
'title' => $this->l('Theme name:'),
'validation' => 'isGenericName',
'choices' => array(
'' => $this->l('Auto detect'),
'classic' => $this->l('PrestaShop 1.7 classic'),
'panda' => $this->l('Panda theme v2'),
'transformer' => $this->l('Transformer theme v4'),
'warehouse' => $this->l('Warehouse for 1.7'),
),
'desc' => $this->l('Select a theme to use its predefined settings.'),
),
$this->module->_prefix_st.'MAXIMUM_TRIES' => [
'title' => $this->l('Maximum times of detecting if the gallery slider is initialized on the product page.'),
'validation' => 'isUnsignedId',
'required' => false,
'cast' => 'intval',
'type' => 'text',
],
$this->module->_prefix_st.'PLAY_VIDEO_TEXT' => [
'title' => $this->l('"Play video" text'),
'size' => 6,
'type' => 'textLang',
],
$this->module->_prefix_st.'YOUTUBE_API' => array(
'title' => $this->l('Stop loading YouTube api'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('If you aren\'t going to use any youtube videos, stop loading the YouTube api for better performace.'),
),
$this->module->_prefix_st.'VIMEO_API' => array(
'title' => $this->l('Stop loading Vimeo api'),
'validation' => 'isBool',
'type' => 'bool',
'is_bool' => true,
'desc' => $this->l('If you aren\'t going to use any vimeo videos, stop loading the vimeo api for better performace.'),
),
$this->module->_prefix_st.'BREAKPOINT' => array(
'type' => 'text',
'title' => $this->l('Mobile device breakpoint'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'desc' => $this->l('If the gallery displays in different ways on mobile, then set the breakpoint here to use different settings on mobile.'),
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player' => array(
'title' => $this->l('Player'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'PLAYER_SKIN' => array(
'title' => $this->l('Skin'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id',
'list' => array(
0 => array(
'id' => 0,
'name' => 'Sublime',
),
1 => array(
'id' => 1,
'name' => 'OGZ',
),
2 => array(
'id' => 2,
'name' => 'Youtube',
),
3 => array(
'id' => 3,
'name' => 'Facebook',
),
),
),
$this->module->_prefix_st.'BG_COLOR' => array(
'title' => $this->l('Control bar background'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'BG_COLOR',
),
$this->module->_prefix_st.'BG_OPACITY' => [
'title' => $this->l('Control bar background opacity'),
'validation' => 'isFloat',
'cast' => 'floatval',
'type' => 'text',
'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'),
],
$this->module->_prefix_st.'CONTROL_COLOR' => array(
'title' => $this->l('Buttons color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'CONTROL_COLOR',
),
$this->module->_prefix_st.'CONTROL_SIZE' => [
'title' => $this->l('Buttons size'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('pixels'),
],
$this->module->_prefix_st.'PROGRESS_BAR_COLOR' => array(
'title' => $this->l('Progress bar color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'PROGRESS_BAR_COLOR',
),
$this->module->_prefix_st.'PROGRESS_BAR_OPACITY' => [
'title' => $this->l('Progress bar opacity'),
'validation' => 'isFloat',
'cast' => 'floatval',
'type' => 'text',
'desc' => $this->l('From 0.0 (fully transparent) to 1.0 (fully opaque).'),
],
$this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR' => array(
'title' => $this->l('Progress bar highlighted color'),
'validation' => 'isColor',
'type' => 'color',
'size' => 5,
'name' => $this->module->_prefix_st.'PROGRESS_BAR_HIGHLIGHT_COLOR',
),
),
'submit' => array('title' => $this->l('Save all')),
),
'player_play_button' => array(
'title' => $this->l('Player\'s play button'),
'icon' => 'icon-cogs',
'fields' => $this->module->getButtonFiledsOptions('PLAYER_PLAY'),
'submit' => array('title' => $this->l('Save all')),
),
'player_close_button' => array(
'title' => $this->l('Player\'s close button'),
'icon' => 'icon-cogs',
'fields' => $this->module->getButtonFiledsOptions('PLAYER_CLOSE'),
'submit' => array('title' => $this->l('Save all')),
),
'style' => array(
'title' => $this->l('Style'),
'icon' => 'icon-cogs',
'fields' => array(
$this->module->_prefix_st.'CUSTOM_CSS' => [
'title' => $this->l('Custom CSS Code'),
'validation' => 'isAnything',
'type' => 'textarea',
'cols' => 30,
'rows' => 5,
],
),
'submit' => array('title' => $this->l('Save all')),
),
);
}
public function updateOptionStEasyVideoCustomCss($val)
{
Configuration::updateValue($this->module->_prefix_st.'CUSTOM_CSS', $val, true);
}
}