Version 5.0.6

This commit is contained in:
Neo committed 2025-12-19 18:55:49 -08:00
1 parent a3a4a9ccbd
commit b89858b2ff
1214 files changed
+92828 -14859

No files matched your search

+16 -27
View File
@@ -20,11 +20,9 @@ use IPS\Helpers\Form\Stack;
use IPS\Helpers\Form\Upload;
use IPS\Helpers\Form\YesNo;
use IPS\Widget\Builder;
use IPS\Widget\Customizable;
use IPS\Widget\StaticCache;
use function count;
use function defined;
use function str_ends_with;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
@@ -35,7 +33,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* pagebuilderupload Widget
*/
class pagebuilderupload extends StaticCache implements Builder, Customizable
class pagebuilderupload extends StaticCache implements Builder
{
/**
* @brief Widget Key
@@ -46,6 +44,11 @@ class pagebuilderupload extends StaticCache implements Builder, Customizable
* @brief App
*/
public string $app = 'cms';
/**
* @var bool
*/
public bool $allowNoBox = true;
@@ -88,12 +91,14 @@ class pagebuilderupload extends StaticCache implements Builder, Customizable
}
$form->add( new Upload( 'pagebuilderupload_upload', $images, FALSE, array( 'multiple' => true, 'storageExtension' => 'core_Attachment', 'allowStockPhotos' => TRUE, 'image' => true ) ) );
// $form->add( new YesNo( 'pagebuilderupload_slideshow', ( $this->configuration['pagebuilderupload_slideshow'] ?? FALSE ) ) );
$form->add( new Stack( 'pagebuilderupload_captions', $captions, FALSE, array( 'stackFieldType' => 'Text', 'removeEmptyValues' => false ) ) );
$form->add( new Stack( 'pagebuilderupload_urls', $urls, FALSE, array( 'stackFieldType' => 'Url', 'removeEmptyValues' => false ) ) );
$form->add( new YesNo( 'pagebuilderupload_tab', $this->configuration['pagebuilderupload_tab'] ?? false ) );
// This is now handled by the page builder
$form->add( new Number( 'pagebuilderupload_height', ( $this->configuration['pagebuilderupload_height'] ?? 300 ), FALSE, array( 'unlimited' => 0 ) ) );
$form->add( new YesNo( 'pagebuilderupload_backdrop', $this->configuration['pagebuilderupload_backdrop'] ?? true, false ) );
return $form;
}
@@ -150,8 +155,12 @@ class pagebuilderupload extends StaticCache implements Builder, Customizable
$images = array();
$captions = ( isset( $this->configuration['pagebuilderupload_captions'] ) ) ? $this->configuration['pagebuilderupload_captions'] : array();
$urls = ( isset( $this->configuration['pagebuilderupload_urls'] ) ) ? json_decode( $this->configuration['pagebuilderupload_urls'], TRUE ) : array();
// $autoPlay = ( isset( $this->configuration['pagebuilderupload_slideshow'] ) ) ? $this->configuration['pagebuilderupload_slideshow'] : FALSE;
$maxHeight = ( isset( $this->configuration['pagebuilderupload_height'] ) ) ? $this->configuration['pagebuilderupload_height'] : FALSE;
$options = [
'maxHeight' => $this->configuration['pagebuilderupload_height'] ?? false,
'showBackdrop' => $this->configuration['pagebuilderupload_backdrop'] ?? true,
'tab' => $this->configuration['pagebuilderupload_tab'] ?? false
];
if ( isset( $this->configuration['pagebuilderupload_upload'] ) )
{
@@ -160,29 +169,9 @@ class pagebuilderupload extends StaticCache implements Builder, Customizable
$images[] = (string) File::get( 'core_Attachment', $img )->url;
}
return $this->output( ( count( $images ) === 1 ? $images[0] : $images ), $captions, $urls, $maxHeight );
return $this->output( ( count( $images ) === 1 ? $images[0] : $images ), $captions, $urls, $options );
}
return '';
}
/**
* @return string[]
*/
public function getSupportedLayouts() : array
{
$layouts = parent::getSupportedLayouts();
/* Remove support for non-carousels; if we have tabs, there is way too much going on here */
$return = [];
foreach( $layouts as $k => $v )
{
if( str_ends_with( $v, '-carousel' ) )
{
$return[] = $v;
}
}
return $return;
}
}