Returns a dataset-definition-object.
This object contains all infos on a defined dataset.
Syntax
datasetDefinition(?string $datasetLabel): string
- $datasetLabel - string
The dataset-label for which to get its definition for.
Example
{# Get the definition-object for dataset "person": #}
{% set dsDef = hublify.datasetDefinition("person") %}
{# ... access here further details with: dsDef.<function>(...) #}Functions
The created dataset-defintion-object provides following functions to easily access all further definition-details.
getFieldDefinition(...)
Returns the definition of a specific field of the dataset-definition.
getFieldDefinition(?string $field): ?array
getFieldI18nString(...)
Returns the i18n-string for a dataset's field.
It regards it explicitly set i18n-string for the field, or builds it from the dataset's i18n-prefix.
getFieldI18nString(?string $field, ?string $suffix = 'name'): ?string
getFields()
Returns an array of all field-labels of the dataset-definition.
getFields(): array
getIconLabel()
Returns the dataset's defined icon-label.
This is the label of the icon that is used to represent the dataset.
getIconLabel(): ?string
getIconUrl(...)
Returns the absolute url for the dataset's defined icon.
This is the label of the icon that is used to represent the dataset.
See main function appIconUrl() for more details.
getIconUrl(?string $weight = null): ?string
getPrimaryDisplayField()
Returns the field-label of the primary display field.
getPrimaryDisplayField(): ?string
getPrimaryField()
Returns the field-label of the primary field.
getPrimaryField(): ?string
getFieldRefToDataset(...)
Returns the field-label referencing to a given target-dataset.
* The fieldDefinition is scanned for the following keys:
* - [MODEL_FIELD_DEF_src_model][MODEL_FIELD_DEF_src_model] == <dataset>
* - [MODEL_FIELD_DEF_fk][MODEL_FIELD_DEF_fk_ref_model] == <dataset
* Returns on first match.
* @param string|null $dataset The target dataset-label to which the field references to.
getFieldRefToDataset(?string $dataset): ?string
getFieldsByDataset(...)
Returns an array of all field-labels within the dataset-definition, that are joined-in from another table, grouped by the dataset-label.
The requirement is: The field's table is different from the dataset's table.
@param array<int,string>|null $datasets Optionally, dataset-label(s) to restrict to, to return.
@return array<string,array<int,string>> Returns an array of all field-labels of the dataset-definition, that are joined-in from another table, with the following structure:
* {
* "<dataset-label>": [
* "<field>",
* ...
* ]
* }
getFieldsByDataset(?array $datasets = null): array
getFieldsByTable(...)
Returns an array of all field-labels within the dataset-definition, that are joined-in from another table, grouped by the database-table-name they are joined-in from.
The requirement is: The field's table is different from the dataset's table.
@param array<int,string>|null $tables Optionally, table-name(s) to restrict to, to return.
@return array<string,array<int,string>> Returns an array of all field-labels of the dataset-definition,
that are joined-in from another table, with the following structure:
* {
* "<table>": [
* "<field>",
* ...
* ]
* }
getFieldsByTable(?array $tables = null): array
getFieldsPrefix()
Returns the (auto-detected) prefix used for the field-labels for this dataset.
This is usually the part before the first underscore ("_") in the primary-field's label.
@return string|null The fields-prefix. In case of an error NULL is returned.
getFieldsPrefix(): ?string
getSelectConfig()
Returns the dataset's optionally defined "modelSelectConfig".
@return array|null The model-select-config. Returns NULL if no config is defined.
getSelectConfig(): ?array
getSystemFields()
Returns an array of all system-field-labels of the dataset-definition.
Usually this is "straingt-forward", but "unfortunately" the system-fields are not always the same, depending on the dataset-definition!
System-fields are the ones like:
* - "<fields_prefix>_insert_time"
* - "<fields_prefix>_insert_user"
* - ...
@return array Returns an associative array of all system-field-labels of the dataset-definition found (auto-detected) or model-wise configured system fields.
[insert_time] - string|null Field that contains the insert-time of a record.
[insert_user] - string|null Field that contains the hfyUser-Name who created/inserted the record.
[update_time] - string|null Field that contains the last update-time of a record.
[update_user] - string|null Field that contains the hfyUser-Name who last updated the record.
[delete_time] - string|null Field that contains the delete-time of a record.
[delete_user] - string|null Field that contains the hfyUser-Name who deleted the record.
[archive_time] - string|null Field that contains the archive-time of a record.
[archive_user] - string|null Field that contains the hfyUser-Name who archived the record.
[plugin] - string|null Field that contains the plugin-label that associates records (!) with plugins
[install_time] - string|null Field that contains the install-time of a record.
[version] - string|null Field that contains the version-name/nr of a record.
[version_unique] - string|null Field that contains the value that is the same for all versions of a record.
[version_current] - string|null Field that contains the value (0/1) that defines whether this record is
[shortdesc] - string|null Field that contains a short description of a record.
[desc] - string|null Field that contains a longer description of a record (plain-text/html).
[state] - string|null Field that contains the state-code (typcially, in Hfy, a varchar(15) field) of a record.
[state_color] - string|null Field that contains the state-color.
[icon] - string|null Field that contains the icon-name/label of a record. Not for the whole dataset!
[icon_color] - string|null Field that contains the icon-color of a record.
[sys_level] - string|null Field that contains the system-level of a record.
[sel_level] - string|null Field that contains the 1. selection-level of a record.
[sel_level2] - string|null Field that contains the 2. selection-level of a record.
[sel_group] - string|null Field that contains the selection-group of a record.
getSystemFields(): array
translate(...)
translate(?string $suffix = 'name'): ?string
translateField(...)
translateField(?string $field, ?string $suffix = 'name'): ?string