Version 5.0.0 beta 5

This commit is contained in:
Neo committed 2025-12-19 17:04:22 -08:00
1 parent 2f24f9de48
commit 57d9db6ce2
218 files changed
+5331 -7416

No files matched your search

+30 -7
View File
@@ -20,9 +20,11 @@ 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' ) )
{
@@ -33,7 +35,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* pagebuilderupload Widget
*/
class pagebuilderupload extends StaticCache implements Builder
class pagebuilderupload extends StaticCache implements Builder, Customizable
{
/**
* @brief Widget Key
@@ -86,10 +88,11 @@ class pagebuilderupload extends StaticCache implements Builder
}
$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' ) ) );
$form->add( new Stack( 'pagebuilderupload_urls', $urls, FALSE, array( 'stackFieldType' => 'Url' ) ) );
// $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 ) ) );
// This is now handled by the page builder
$form->add( new Number( 'pagebuilderupload_height', ( $this->configuration['pagebuilderupload_height'] ?? 300 ), FALSE, array( 'unlimited' => 0 ) ) );
return $form;
}
@@ -147,7 +150,7 @@ class pagebuilderupload extends StaticCache implements Builder
$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;
// $autoPlay = ( isset( $this->configuration['pagebuilderupload_slideshow'] ) ) ? $this->configuration['pagebuilderupload_slideshow'] : FALSE;
$maxHeight = ( isset( $this->configuration['pagebuilderupload_height'] ) ) ? $this->configuration['pagebuilderupload_height'] : FALSE;
if ( isset( $this->configuration['pagebuilderupload_upload'] ) )
@@ -157,9 +160,29 @@ class pagebuilderupload extends StaticCache implements Builder
$images[] = (string) File::get( 'core_Attachment', $img )->url;
}
return $this->output( ( count( $images ) === 1 ? $images[0] : $images ), $captions, $urls, $autoPlay, $maxHeight );
return $this->output( ( count( $images ) === 1 ? $images[0] : $images ), $captions, $urls, $maxHeight );
}
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;
}
}