dev #9
@ -101,6 +101,10 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
|
||||||
|
|
||||||
- **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | SPK: `Super---b84e947d_2a13_44f7_ac0f_3902ae55ae0c---Power`
|
- **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | SPK: `Super---b84e947d_2a13_44f7_ac0f_3902ae55ae0c---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\File](#vdm-joomla-componentbuilder-file)
|
||||||
|
|
||||||
|
- **abstract class Factory** | [Details](src/884eca78-281f-4eab-b962-d97e355af16d) | [Code](src/884eca78-281f-4eab-b962-d97e355af16d/code.php) | [Settings](src/884eca78-281f-4eab-b962-d97e355af16d/settings.json) | SPK: `Super---884eca78_281f_4eab_b962_d97e355af16d---Power`
|
||||||
|
- **final class Type** | [Details](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e) | [Code](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php) | [Settings](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json) | SPK: `Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Table](#vdm-joomla-componentbuilder-table)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Table](#vdm-joomla-componentbuilder-table)
|
||||||
|
|
||||||
- **final class Schema** | [Details](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce) | [Code](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/code.php) | [Settings](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/settings.json) | SPK: `Super---b3d2ec33_76d4_4c3b_bb2c_86ac14a221ce---Power`
|
- **final class Schema** | [Details](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce) | [Code](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/code.php) | [Settings](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/settings.json) | SPK: `Super---b3d2ec33_76d4_4c3b_bb2c_86ac14a221ce---Power`
|
||||||
@ -156,6 +160,9 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | SPK: `Super---ff7d0111_8f79_42aa_ac14_b53ba2c49369---Power`
|
- **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | SPK: `Super---ff7d0111_8f79_42aa_ac14_b53ba2c49369---Power`
|
||||||
- **trait ToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | SPK: `Super---7d494d91_ab60_43cd_aecf_d50e07f7f30e---Power`
|
- **trait ToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | SPK: `Super---7d494d91_ab60_43cd_aecf_d50e07f7f30e---Power`
|
||||||
- **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | SPK: `Super---52a1d14f_304a_431c_8fa4_411179942db5---Power`
|
- **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | SPK: `Super---52a1d14f_304a_431c_8fa4_411179942db5---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\File\Service](#vdm-joomla-componentbuilder-file-service)
|
||||||
|
|
||||||
|
- **class File** | [Details](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088) | [Code](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php) | [Settings](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json) | SPK: `Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities\Exception](#vdm-joomla-componentbuilder-utilities-exception)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities\Exception](#vdm-joomla-componentbuilder-utilities-exception)
|
||||||
|
|
||||||
- **class NoUserIdFoundException** | [Details](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d) | [Code](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.php) | [Settings](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/settings.json) | SPK: `Super---1c10a5f1_204d_4f17_ad9f_0e0684f2030d---Power`
|
- **class NoUserIdFoundException** | [Details](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d) | [Code](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.php) | [Settings](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/settings.json) | SPK: `Super---1c10a5f1_204d_4f17_ad9f_0e0684f2030d---Power`
|
||||||
|
101
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/README.md
Normal file
101
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/README.md
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Type (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\File**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Type << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Item $item
|
||||||
|
# string $fileTypes
|
||||||
|
+ __construct(Item $item)
|
||||||
|
+ get(string $guid) : ?array
|
||||||
|
+ details(string $guid) : ?object
|
||||||
|
# getFieldName(array $data) : string
|
||||||
|
# getAllow(array $data) : string
|
||||||
|
# getAllowSpan(array $data) : string
|
||||||
|
# getAllowFormats(array $data) : ?array
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Type::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::get
|
||||||
|
Retrieves the file type details (ajax)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::details
|
||||||
|
Retrieves the file type details
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getFieldName
|
||||||
|
Retrieves the field name
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getAllow
|
||||||
|
Retrieves the allow formats (for script)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getAllowSpan
|
||||||
|
Retrieves the allow formats (for span)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getAllowFormats
|
||||||
|
Retrieves the allow formats
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
147
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.power
Normal file
147
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.power
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The File Types
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $fileTypes = [1 => 'image' , 2 => 'document' , 3 => 'media', 4 => 'file'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Item $item)
|
||||||
|
{
|
||||||
|
$this->item = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details (ajax)
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
|
||||||
|
*
|
||||||
|
* @return array|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function get(string $guid): ?array
|
||||||
|
{
|
||||||
|
if (($fileType = $this->details($guid)) !== null)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->getFieldName($fileType),
|
||||||
|
'allow' => $this->getAllow($fileType),
|
||||||
|
'allow_span' => $this->getAllowSpan($fileType),
|
||||||
|
'file_type_span' => $fileType->name ?? 'file',
|
||||||
|
'display_fields' => $fileType->display_fields ?? null,
|
||||||
|
'param_fields' => $fileType->param_fields ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
|
||||||
|
*
|
||||||
|
* @return object|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function details(string $guid): ?object
|
||||||
|
{
|
||||||
|
return $this->item->table('file_type')->get($guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the field name
|
||||||
|
*
|
||||||
|
* @param array $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The field name
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getFieldName(array $data): string
|
||||||
|
{
|
||||||
|
$type = data->type ?? 4;
|
||||||
|
if (isset($this->fileTypes[$type]))
|
||||||
|
{
|
||||||
|
return $this->fileTypes[$type];
|
||||||
|
}
|
||||||
|
return 'file';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for script)
|
||||||
|
*
|
||||||
|
* @param array $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllow(array $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '*.(' . implode('|', $formats) . ')';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for span)
|
||||||
|
*
|
||||||
|
* @param array $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowSpan(array $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '(formats allowed: <b>' . implode(', ', $formats) . '</b>)';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats
|
||||||
|
*
|
||||||
|
* @param array|null $data The type data array
|
||||||
|
*
|
||||||
|
* @return array|null The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowFormats(array $data): ?array
|
||||||
|
{
|
||||||
|
$type = data->type ?? 4;
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return $data->image_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return $data->document_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return $data->media_formats ?? null;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return $data->file_formats ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
24
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json
Normal file
24
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"add_head": "0",
|
||||||
|
"description": "File Type Class\r\n\r\n@since 5.0.2",
|
||||||
|
"extends": "",
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"extendsinterfaces_custom": "",
|
||||||
|
"guid": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
|
||||||
|
"head": "",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
|
"as": "Item"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Type",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "Joomla.File.Type",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Type",
|
||||||
|
"composer": "",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n"
|
||||||
|
}
|
60
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/README.md
Normal file
60
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/README.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class File (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\File\Service**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class File #Gold {
|
||||||
|
+ register(Container $container) : void
|
||||||
|
+ getFileType(Container $container) : FileType
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of File::register
|
||||||
|
Registers the service provider with a DI container.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of File::getFileType
|
||||||
|
Get The File Type Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: FileType
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
28
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.power
Normal file
28
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.power
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(FileType::class, 'File.Type')
|
||||||
|
->share('File.Type', [$this, 'getFileType'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The File Type Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return FileType
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getFileType(Container $container): FileType
|
||||||
|
{
|
||||||
|
return new FileType(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
27
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json
Normal file
27
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"add_head": "1",
|
||||||
|
"description": "File Service Provider\r\n\r\n@since 5.0.3",
|
||||||
|
"extends": "",
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"extendsinterfaces_custom": "",
|
||||||
|
"guid": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
||||||
|
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"implements": [
|
||||||
|
"-1"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "File",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.File.Service.File",
|
||||||
|
"type": "class",
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Service.File",
|
||||||
|
"composer": "",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n"
|
||||||
|
}
|
53
src/884eca78-281f-4eab-b962-d97e355af16d/README.md
Normal file
53
src/884eca78-281f-4eab-b962-d97e355af16d/README.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# abstract class Factory (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\File**
|
||||||
|
> extends: **Factory**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
abstract Factory #Orange {
|
||||||
|
# {static} createContainer() : Container
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Factory::createContainer
|
||||||
|
Create a container object
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: Container
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---884eca78_281f_4eab_b962_d97e355af16d---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
15
src/884eca78-281f-4eab-b962-d97e355af16d/code.power
Normal file
15
src/884eca78-281f-4eab-b962-d97e355af16d/code.power
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Create a container object
|
||||||
|
*
|
||||||
|
* @return Container
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
protected static function createContainer(): Container
|
||||||
|
{
|
||||||
|
return (new Container())
|
||||||
|
->registerServiceProvider(new Table())
|
||||||
|
->registerServiceProvider(new Database())
|
||||||
|
->registerServiceProvider(new Model())
|
||||||
|
->registerServiceProvider(new Data())
|
||||||
|
->registerServiceProvider(new File());
|
||||||
|
}
|
42
src/884eca78-281f-4eab-b962-d97e355af16d/settings.json
Normal file
42
src/884eca78-281f-4eab-b962-d97e355af16d/settings.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"add_head": "1",
|
||||||
|
"description": "File Factory\r\n\r\n@since 5.0.2",
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"extendsinterfaces_custom": "",
|
||||||
|
"guid": "884eca78-281f-4eab-b962-d97e355af16d",
|
||||||
|
"head": "use Joomla\\DI\\Container;",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "19b2ba92-1655-4384-acfb-979c80de8b6d",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "4815e1c7-a433-443d-a112-d1e03d7df84b",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "2dcedd6c-c95b-4a37-9cac-95d28faedca3",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "a5daf189-3345-4b13-8716-c51f686f545b",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection4": {
|
||||||
|
"use": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"implements": [
|
||||||
|
"caf33c5d-858c-4f9a-894f-ab302ec5445a"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Factory",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.File.Factory",
|
||||||
|
"type": "abstract class",
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Factory",
|
||||||
|
"composer": "",
|
||||||
|
"add_licensing_template": "2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n"
|
||||||
|
}
|
@ -1043,5 +1043,38 @@
|
|||||||
"path": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319",
|
"path": "src\/ffbd4e1f-a342-4080-ab7d-1de3741bf319",
|
||||||
"spk": "Super---ffbd4e1f_a342_4080_ab7d_1de3741bf319---Power",
|
"spk": "Super---ffbd4e1f_a342_4080_ab7d_1de3741bf319---Power",
|
||||||
"guid": "ffbd4e1f-a342-4080-ab7d-1de3741bf319"
|
"guid": "ffbd4e1f-a342-4080-ab7d-1de3741bf319"
|
||||||
|
},
|
||||||
|
"12a2a8de-a893-4dbb-a53d-b52de4f6cb0e": {
|
||||||
|
"name": "Type",
|
||||||
|
"type": "final class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\File",
|
||||||
|
"code": "src\/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e\/code.php",
|
||||||
|
"power": "src\/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e\/code.power",
|
||||||
|
"settings": "src\/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e\/settings.json",
|
||||||
|
"path": "src\/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
|
||||||
|
"spk": "Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power",
|
||||||
|
"guid": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e"
|
||||||
|
},
|
||||||
|
"202ccd9e-dfcf-4cde-a0ce-bde1fd27f088": {
|
||||||
|
"name": "File",
|
||||||
|
"type": "class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\File\\Service",
|
||||||
|
"code": "src\/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088\/code.php",
|
||||||
|
"power": "src\/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088\/code.power",
|
||||||
|
"settings": "src\/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088\/settings.json",
|
||||||
|
"path": "src\/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
||||||
|
"spk": "Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power",
|
||||||
|
"guid": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088"
|
||||||
|
},
|
||||||
|
"884eca78-281f-4eab-b962-d97e355af16d": {
|
||||||
|
"name": "Factory",
|
||||||
|
"type": "abstract class",
|
||||||
|
"namespace": "VDM\\Joomla\\Componentbuilder\\File",
|
||||||
|
"code": "src\/884eca78-281f-4eab-b962-d97e355af16d\/code.php",
|
||||||
|
"power": "src\/884eca78-281f-4eab-b962-d97e355af16d\/code.power",
|
||||||
|
"settings": "src\/884eca78-281f-4eab-b962-d97e355af16d\/settings.json",
|
||||||
|
"path": "src\/884eca78-281f-4eab-b962-d97e355af16d",
|
||||||
|
"spk": "Super---884eca78_281f_4eab_b962_d97e355af16d---Power",
|
||||||
|
"guid": "884eca78-281f-4eab-b962-d97e355af16d"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user