Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

@@ -11,61 +11,69 @@
namespace IPS\core\ProfileFields;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Helpers\Form;
use IPS\Helpers\Form\Translatable;
use IPS\Http\Url;
use IPS\Lang;
use IPS\Node\Model;
use function defined;
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
}
/**
* Custom Profile Field Group Node
*/
class _Group extends \IPS\Node\Model
class Group extends Model
{
/**
* @brief [ActiveRecord] Multiton Store
*/
protected static $multitons;
protected static array $multitons;
/**
* @brief [ActiveRecord] Database Table
*/
public static $databaseTable = 'core_pfields_groups';
public static ?string $databaseTable = 'core_pfields_groups';
/**
* @brief [ActiveRecord] Database Prefix
*/
public static $databasePrefix = 'pf_group_';
public static string $databasePrefix = 'pf_group_';
/**
* @brief [ActiveRecord] ID Database Column
*/
public static $databaseColumnId = 'id';
public static string $databaseColumnId = 'id';
/**
* @brief [Node] Order Database Column
*/
public static $databaseColumnOrder = 'order';
public static ?string $databaseColumnOrder = 'order';
/**
* @brief [Node] Node Title
*/
public static $nodeTitle = 'profile_fields';
public static string $nodeTitle = 'profile_fields';
/**
* @brief [Node] Subnode class
*/
public static $subnodeClass = 'IPS\core\ProfileFields\Field';
public static ?string $subnodeClass = 'IPS\core\ProfileFields\Field';
/**
* @brief [Node] Show forms modally?
*/
public static $modalForms = TRUE;
public static bool $modalForms = TRUE;
/**
* @brief [Node] ACP Restrictions
*/
protected static $restrictions = array(
protected static ?array $restrictions = array(
'app' => 'core',
'module' => 'membersettings',
'prefix' => 'profilefieldgroups_',
@@ -74,33 +82,35 @@ class _Group extends \IPS\Node\Model
/**
* @brief [Node] Title prefix. If specified, will look for a language key with "{$key}_title" as the key
*/
public static $titleLangPrefix = 'core_pfieldgroups_';
public static ?string $titleLangPrefix = 'core_pfieldgroups_';
/**
* [Node] Add/Edit Form
*
* @param \IPS\Helpers\Form $form The form
* @param Form $form The form
* @return void
*/
public function form( &$form )
public function form( Form &$form ) : void
{
$form->add( new \IPS\Helpers\Form\Translatable( 'pfield_group_title', NULL, TRUE, array( 'app' => 'core', 'key' => ( $this->id ? "core_pfieldgroups_{$this->id}" : NULL ) ) ) );
$form->add( new Translatable( 'pfield_group_title', NULL, TRUE, array( 'app' => 'core', 'key' => ( $this->id ? "core_pfieldgroups_{$this->id}" : NULL ) ) ) );
}
/**
* [Node] Save Add/Edit Form
*
* @param array $values Values from the form
* @return void
* @return mixed
*/
public function saveForm( $values )
public function saveForm( array $values ): mixed
{
if ( !$this->id )
{
$this->save();
}
\IPS\Lang::saveCustom( 'core', "core_pfieldgroups_{$this->id}", $values['pfield_group_title'] );
Lang::saveCustom( 'core', "core_pfieldgroups_{$this->id}", $values['pfield_group_title'] );
return NULL;
}
/**
@@ -108,7 +118,7 @@ class _Group extends \IPS\Node\Model
*
* @return bool
*/
public function canManagePermissions()
public function canManagePermissions(): bool
{
return false;
}
@@ -118,21 +128,21 @@ class _Group extends \IPS\Node\Model
* Example code explains return value
*
* @code
array(
array(
'icon' => 'plus-circle', // Name of FontAwesome icon to use
'title' => 'foo', // Language key to use for button's title parameter
'link' => \IPS\Http\Url::internal( 'app=foo...' ) // URI to link to
'class' => 'modalLink' // CSS Class to use on link (Optional)
),
... // Additional buttons
);
* array(
* array(
* 'icon' => 'plus-circle', // Name of FontAwesome icon to use
* 'title' => 'foo', // Language key to use for button's title parameter
* 'link' => \IPS\Http\Url::internal( 'app=foo...' ) // URI to link to
* 'class' => 'modalLink' // CSS Class to use on link (Optional)
* ),
* ... // Additional buttons
* );
* @endcode
* @param string $url Base URL
* @param Url $url Base URL
* @param bool $subnode Is this a subnode?
* @return array
*/
public function getButtons( $url, $subnode=FALSE )
public function getButtons( Url $url, bool $subnode=FALSE ):array
{
$buttons = parent::getButtons( $url, $subnode );