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

+60 -1
View File
@@ -19,7 +19,9 @@ use IPS\Helpers\Form;
use IPS\Helpers\Form\Radio;
use IPS\Helpers\Form\TextArea;
use IPS\Helpers\Form\YesNo;
use IPS\Lang;
use IPS\Member;
use IPS\Node\Permissions;
use IPS\Settings;
use function defined;
@@ -32,7 +34,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
/**
* Field Node
*/
class Field extends CustomField
class Field extends CustomField implements Permissions
{
/**
* @brief [ActiveRecord] Multiton Store
@@ -85,6 +87,30 @@ class Field extends CustomField
* @brief [CustomField] Set to TRUE if uploads fields are capable of holding the submitted content for moderation
*/
public static bool $uploadsCanBeModerated = TRUE;
/**
* @brief The map of permission columns
*/
public static array $permissionMap = array(
'view' => 'view',
'edit' => 2,
'add' => 3
);
/**
* @brief [Node] App for permission index
*/
public static ?string $permApp = 'downloads';
/**
* @brief [Node] Type for permission index
*/
public static ?string $permType = 'fields';
/**
* @brief [Node] Prefix string that is automatically prepended to permission matrix language strings
*/
public static string $permissionLangPrefix = 'perm_cfield_';
/**
* @brief [Node] ACP Restrictions
@@ -121,6 +147,17 @@ class Field extends CustomField
return $this->format;
}
/**
*
* [Node] Does the currently logged-in user have permission to edit permissions for this node?
*
* @return bool
*/
public function canManagePermissions() : bool
{
return true;
}
/**
* [Node] Add/Edit Form
*
@@ -178,4 +215,26 @@ class Field extends CustomField
return parent::formatFormValues( $values );
}
/**
* Get output for API
*
* @param Member|NULL $authorizedMember The member making the API request or NULL for API Key / client_credentials
* @param array $fieldValues Current values for a specific file
* @return array
* @apiresponse int id ID number
* @apiresponse string name Name
* @apiresponse string description Description
* @apiresponse string value Current value for this file
*/
public function apiOutput( ?Member $authorizedMember = NULL, array $fieldValues=array() ): array
{
$lang = $authorizedMember ? $authorizedMember->language() : Lang::load( Lang::defaultLanguage() );
return [
'id' => $this->id,
'name' => $lang->addToStack( 'downloads_field_' . $this->id ),
'description' => $lang->addToStack( 'downloads_field_' . $this->id . '_desc' ),
'value' => $fieldValues[ 'field_' . $this->id ] ?? null
];
}
}