Function Resource_fs_base->convert_label_to_id
Definitions
sources/resource_fs_base_class.php
- Convert a label to an ID, possibly with auto-creating if needed. This is useful for the software-side resource-agnostic API.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $_label | SHORT_TEXT | No | No | required parameter | N/A | N/A | Resource label |
| $subpath | string | No | No | required parameter | N/A | N/A | The path (blank: root / not applicable). It may end in "/*" if you want to look for a match under a certain directory |
| $resource_type | ID_TEXT | No | No | required parameter | N/A | N/A | Resource type |
| $must_already_exist | boolean | No | No | False | N/A | N/A | Whether the content must already exist |
| $use_guid_for_new | ?ID_TEXT | No | No | Null | N/A | N/A | GUID to auto-create with (null: either not auto-creating, or not specifying the GUID if we are) |
Returns
- The ID (null: not found)
- Type: ?ID_TEXT
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Convert a label to an ID, possibly with auto-creating if needed. This is useful for the software-side resource-agnostic API.
*
* @param SHORT_TEXT $_label Resource label
* @param string $subpath The path (blank: root / not applicable). It may end in "/*" if you want to look for a match under a certain directory
* @param ID_TEXT $resource_type Resource type
* @param boolean $must_already_exist Whether the content must already exist
* @param ?ID_TEXT $use_guid_for_new GUID to auto-create with (null: either not auto-creating, or not specifying the GUID if we are)
* @return ?ID_TEXT The ID (null: not found)
*/
public function convert_label_to_id(string $_label, string $subpath, string $resource_type, bool $must_already_exist = false, ?string $use_guid_for_new = null) : ?string
* Convert a label to an ID, possibly with auto-creating if needed. This is useful for the software-side resource-agnostic API.
*
* @param SHORT_TEXT $_label Resource label
* @param string $subpath The path (blank: root / not applicable). It may end in "/*" if you want to look for a match under a certain directory
* @param ID_TEXT $resource_type Resource type
* @param boolean $must_already_exist Whether the content must already exist
* @param ?ID_TEXT $use_guid_for_new GUID to auto-create with (null: either not auto-creating, or not specifying the GUID if we are)
* @return ?ID_TEXT The ID (null: not found)
*/
public function convert_label_to_id(string $_label, string $subpath, string $resource_type, bool $must_already_exist = false, ?string $use_guid_for_new = null) : ?string

