### getFromPath: Get setup from a path and ViewHelper usage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets setup from a given path, e.g. 'plugin.tx_example.settings'. Also acts as a ViewHelper. Returns an array. ```php \nn\t3::Settings()->getFromPath('plugin.path'); \nn\t3::Settings()->getFromPath('L', \nn\t3::Request()->GP()); \nn\t3::Settings()->getFromPath('a.b', ['a'=>['b'=>1]]); ``` ```fluid {nnt3:ts.setup(path:'path.zur.setup')} ``` -------------------------------- ### nn\t3::Settings()->getFromPath($tsPath = '', $setup = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets setup from a given path, e.g. 'plugin.tx_example.settings'. Also acts as a ViewHelper. ```APIDOC ## getFromPath($tsPath = '', $setup = NULL) ### Description Gets setup from a given path, e.g. 'plugin.tx_example.settings'. Also acts as a ViewHelper. ### Method `getFromPath` ### Parameters - `$tsPath` (string) - Optional - The path to the setup. - `$setup` (mixed) - Optional - The setup array to search in. Defaults to NULL. ### Return `array` ### Example ```php \nn\t3::Settings()->getFromPath('plugin.path'); \nn\t3::Settings()->getFromPath('L', \nn\t3::Request()->GP()); \nn\t3::Settings()->getFromPath('a.b', ['a'=>['b'=>1]]); ``` ### ViewHelper Usage ``` {nnt3:ts.setup(path:'path.zur.setup')} ``` ``` -------------------------------- ### getFullTyposcript: Get complete TypoScript setup Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the complete TypoScript setup as a simple array without '.' syntax. Works in both frontend and backend, with or without a given pid. Returns an array. ```php \nn\t3::Settings()->getFullTyposcript(); \nn\t3::Settings()->getFullTyposcript( $pid ); ``` -------------------------------- ### getPlugin: Get plugin TypoScript setup Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the setup for a specific plugin. Specify $extensionName only when fetching a foreign extension's setup or when there is no controller context (e.g., from backend). Returns an array. ```php \nn\t3::Settings()->getPlugin('extname') returns TypoScript from plugin.tx_extname... ``` -------------------------------- ### get method usage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/settings.rst.txt Gets the TypoScript setup and the 'settings' section. Values from FlexForm are not remembered in the process. ```php \nn\t3::Settings()->get( 'nnsite' ); \nn\t3::Settings()->get( 'nnsite', 'path.in.settings' ); ``` -------------------------------- ### nn\t3::Settings()->getPlugin($extName = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the setup for a specific plugin. ```APIDOC ## getPlugin($extName = NULL) ### Description Gets the setup for a specific plugin. Important: specify `$extensionName` only if the setup of a foreign extension should be fetched or there is no controller context because the call is made e.g. from the backend. ### Method `getPlugin` ### Parameters - `$extName` (string) - Optional - The extension key. ### Return `array` ### Example ```php \nn\t3::Settings()->getPlugin('extname') returns TypoScript from plugin.tx_extname... ``` ``` -------------------------------- ### \nn\t3::BackendUser()->start() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/backendUser.html Starts (fakes) a backend user. Solves the problem that, for example, from the scheduler certain functions like log() are not possible if there is no active BE user. ```APIDOC ## \nn\t3::BackendUser()->start() ### Description Starts (fakes) a backend user. Solves the problem that, for example, from the scheduler certain functions like `log()` are not possible if there is no active BE user. ### Method `start()` ### Return Value `\TYPO3\CMS\Backend\FrontendBackendUserAuthentication` ### Example ```php \nn\t3::BackendUser()->start(); ``` ``` -------------------------------- ### nnt3:ts.setup usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/ViewHelpers/Classes/ts.setup.html Use the nnt3:ts.setup ViewHelper to retrieve values from TypoScript setup. The path attribute specifies the dot-separated path to the desired setup value. The optional key attribute can be set to 'setup' to access the setup section. Dynamic keys can be included in the path using curly braces. The return type is mixed. ```fluid {nnt3:ts.setup(path:'path.to.typoscript.setup')} {nnt3:ts.setup(path:'path.zum.typoscript', key:'setup')} {nnt3:ts.setup(path:'path.zum.typoscript.{dynamicKey}.whatever')} ``` -------------------------------- ### nn\t3::Settings()->get($extensionName = '', $path = '') Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the TypoScript setup and returns the 'settings' section. Alias to \nn\t3::Settings()->getSettings(). ```APIDOC ## get($extensionName = '', $path = '') ### Description Gets the TypoScript setup and returns the 'settings' section. Values from the FlexForm will not be remembered in the process. Alias to `\nn\t3::Settings()->getSettings()`. ### Method `get` ### Parameters - `$extensionName` (string) - Optional - The extension key. - `$path` (string) - Optional - Path within the settings array. ### Return `array` ### Example ```php \nn\t3::Settings()->get( 'nnsite' ); \nn\t3::Settings()->get( 'nnsite', 'path.in.settings' ); ``` ``` -------------------------------- ### getPlugin method usage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/settings.rst.txt Gets the setup for a specific plugin. Specify $extensionName only if fetching a foreign extension or when there is no controller context. ```php \nn\t3::Settings()->getPlugin('extname') returns TypoScript from plugin.tx_extname... ``` -------------------------------- ### getSettings: Get TypoScript settings section Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the TypoScript setup and returns the 'settings' section. Values from the FlexForm are not remembered. Returns an array. ```php \nn\t3::Settings()->getSettings( 'nnsite' ); \nn\t3::Settings()->getSettings( 'nnsite', 'example.path' ); ``` -------------------------------- ### ts.setup ViewHelper Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/ViewHelpers/Classes/ts.setup.rst.txt Retrieves a value from the TypoScript setup. Use the path argument to specify the dot-separated path to the desired setup value. Optionally, specify the key ('setup' or 'constants') to select the TypoScript section. The return value is mixed. ```APIDOC ## ts.setup ViewHelper ### Description Get value from the TypoScript setup. Easy and direct access from within the fluid template - regardless of the extension rendering the template. ### Usage ```php {nnt3:ts.setup(path:'path.to.typoscript.setup')} {nnt3:ts.setup(path:'path.zum.typoscript', key:'setup')} {nnt3:ts.setup(path:'path.zum.typoscript.{dynamicKey}.whatever')} ``` ### Parameters - **path** (string) - Required - The dot-separated path to the TypoScript setup value. - **key** (string) - Optional - The TypoScript section key (e.g., 'setup' or 'constants'). Defaults to 'setup'. ### Return Value - **mixed** - The value from the TypoScript setup. ``` -------------------------------- ### nn\t3::File()->mkdir() Examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Creates a folder. The examples show creating a folder with a path and with a storage ID prefix. ```php nn\t3::File()->mkdir( 'fileadmin/my/folder/' ); nn\t3::File()->mkdir( '1:/my/folder/' ); ``` -------------------------------- ### fromString usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/typoScript.html Converts a text into a TypoScript array. Takes a string and an optional override setup array, returns an array. The first example shows the resulting array structure. ```php \nn\t3::TypoScript()->fromString( 'lib.test { example = 10 }' ); => ['lib'=>['test'=>['example'=>10]] \nn\t3::TypoScript()->fromString( 'lib.test { example = 10 }', $mergeSetup ); ``` -------------------------------- ### render method simple example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/message.rst.txt Renders the flash messages in the queue. Simple example: set an OK message and render it. ```php \nn\t3::Message()->OK('Yes', 'No'); echo \nn\t3::Message()->render(); ``` -------------------------------- ### nn\t3::Settings()->getSettings($extensionName = '', $path = '') Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the TypoScript setup and returns the 'settings' section. Values from the FlexForm will not be remembered. ```APIDOC ## getSettings($extensionName = '', $path = '') ### Description Gets the TypoScript setup and returns the 'settings' section. Values from the FlexForm will not be remembered. ### Method `getSettings` ### Parameters - `$extensionName` (string) - Optional - The extension key. - `$path` (string) - Optional - Path within the settings array. ### Return `array` ### Example ```php \nn\t3::Settings()->getSettings( 'nnsite' ); \nn\t3::Settings()->getSettings( 'nnsite', 'example.path' ); ``` ``` -------------------------------- ### Retrieve TypoScript setup value with nnt3:ts.setup Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/ViewHelpers/Classes/ts.setup.rst.txt Use the ViewHelper to retrieve a value from the TypoScript setup. The path argument is required and can include dynamic keys using curly braces. The optional key argument specifies the setup key to access. ```php {nnt3:ts.setup(path:'path.to.typoscript.setup')} {nnt3:ts.setup(path:'path.zum.typoscript', key:'setup')} {nnt3:ts.setup(path:'path.zum.typoscript.{dynamicKey}.whatever')} ``` -------------------------------- ### get: Retrieve TypoScript settings section Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the TypoScript setup and returns the 'settings' section. Values from the FlexForm are not remembered. Alias to \nn\t3::Settings()->getSettings(). Returns an array. ```php \nn\t3::Settings()->get( 'nnsite' ); \nn\t3::Settings()->get( 'nnsite', 'path.in.settings' ); ``` -------------------------------- ### Start fake backend user: \nn\t3::BackendUser()->start() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/backendUser.html Starts a fake backend user to enable functions like log() in contexts without an active BE user, such as scheduler jobs. Returns a \TYPO3\CMS\Backend\FrontendBackendUserAuthentication instance. ```php \nn\t3::BackendUser()->start(); ``` -------------------------------- ### Get first storage PID with nn\t3::Settings()->getStoragePid() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Returns the first storage PID for the current plugin. The value is read from TypoScript setup (plugin.tx_extname.persistence.storagePid) or the plugin's FlexForm. If $extName is left blank, the value is merged with the selected StoragePID from the FlexForm. The method returns a string. ```php \nn\t3::Settings()->getStoragePid(); // 123 \nn\t3::Settings()->getStoragePid('nnsite'); // 466 ``` -------------------------------- ### nn\t3::Settings()->getFullTyposcript($pid = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets the complete TypoScript setup as a simple array without '.' syntax. Works in both frontend and backend. ```APIDOC ## getFullTyposcript($pid = NULL) ### Description Gets the complete TypoScript setup as a simple array without '.' syntax. Works in both frontend and backend, with and without a given pid. ### Method `getFullTyposcript` ### Parameters - `$pid` (int) - Optional - The page ID. ### Return `array` ### Example ```php \nn\t3::Settings()->getFullTyposcript(); \nn\t3::Settings()->getFullTyposcript( $pid ); ``` ``` -------------------------------- ### setId Method Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/message.html Determines which MessageQueue to use. Example sets ID to 'top' and adds an OK message. ```php \nn\t3::Message()->setId('top')->OK('title', 'infotext'); ``` -------------------------------- ### nn\t3::File()->getPublicUrl() Examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Gets path to file relative to TYPO3 installation directory. Can handle various object types including FileReference, Extbase FileReference, Folder, and can return absolute URL when second parameter is true. ```php nn\t3::File()->getPublicUrl( $falFile ); // \TYPO3\CMS\Core\Resource\FileReference. nn\t3::File()->getPublicUrl( $fileReference ); // \TYPO3\CMS\Extbase\Domain\Model\FileReference nn\t3::File()->getPublicUrl( $folder ); // \TYPO3\CMS\Core\Resource\Folder nn\t3::File()->getPublicUrl( $folder, true ); // https://.../fileadmin/bild.jpg ``` -------------------------------- ### Get source code of a method Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/AdditionalClasses/Classes/documentationHelper.rst.txt Example of using parseClass() to get the raw PHP source code of a method in a class. ```php \Nng\Nnhelpers\Helpers\DocumentationHelper::parseClass( \Nng\Classes\MyClass::class, 'myMethodName' ); ``` -------------------------------- ### TypoScript setup for rootLineFields Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/registry.html TypoScript setup to use the registered field in a FLUIDTEMPLATE. The example uses levelfield to slide the 'footerelement' field. ```typoscript page.10 = FLUIDTEMPLATE page.10.variables { footer = TEXT footer { data = levelfield:-1, footerelement, slide } } ``` -------------------------------- ### Get all storage PIDs with nn\t3::Settings()->getStoragePids() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Returns all storage PIDs for the current plugin as an array. The PIDs are stored as a comma-separated list in TypoScript setup (plugin.tx_extname.persistence.storagePid) or in the FlexForm. If $extName is left blank, the value is merged with the selected StoragePID from the FlexForm. The method returns an array. ```php \nn\t3::Settings()->getStoragePids(); // [123, 466] \nn\t3::Settings()->getStoragePids('nnsite'); // [123, 466] ``` -------------------------------- ### nn\t3::File()->move() Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Moves a file. The example shows moving 'fileadmin/image.jpg' to 'fileadmin/image-copy.jpg'. ```php nn\t3::File()->move('fileadmin/image.jpg', 'fileadmin/image-copy.jpg'); ``` -------------------------------- ### Render FlashMessages Simple Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/message.html Simple example of rendering flash messages: add an OK message and then render. ```php \nn\t3::Message()->OK('Yes', 'No'); echo \nn\t3::Message()->render(); ``` -------------------------------- ### getQueryBuilder - Get query builder for a table Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/db.html Get a QueryBuilder for a table. The example shows a basic select query with a named parameter. ```php $queryBuilder = \nn\t3::Db()->getQueryBuilder( 'fe_users' ); ``` ```php $queryBuilder = \nn\t3::Db()->getQueryBuilder( 'fe_users' ); $queryBuilder->select('name')->from( 'fe_users' ); $queryBuilder->andWhere( $queryBuilder->expr()->eq( 'uid', $queryBuilder->createNamedParameter(12) )); $rows = $queryBuilder->execute()->fetchAll(); ``` -------------------------------- ### Get public URL of a file Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/file.rst.txt Gets path to file, relative to Typo3 installation directory (PATH_site). Can handle all types of objects. ```php \nn\t3::File()->getPublicUrl( $falFile ); // \TYPO3\CMS\Core\Resource\FileReference. \nn\t3::File()->getPublicUrl( $fileReference ); // \TYPO3\CMS\Extbase\Domain\Model\FileReference \nn\t3::File()->getPublicUrl( $folder ); // \TYPO3\CMS\Core\Resource\Folder \nn\t3::File()->getPublicUrl( $folder, true ); // https://.../fileadmin/bild.jpg ``` -------------------------------- ### File->write() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Shows how to create folders and files using different path notations: relative path, combined identifier, and with content. Creates folders recursively if they do not exist. Returns boolean. ```php nn\t3::File()->write('fileadmin/some/deep/folder/'); nn\t3::File()->write('1:/some/deep/folder/'); nn\t3::File()->write('fileadmin/some/deep/folder/file.json', 'TEXT'); ``` -------------------------------- ### nn\t3::File()->read() example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Gets the contents of a file. ```php \nn\t3::File()->read('fileadmin/text.txt'); ``` -------------------------------- ### getAddress() example return Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/geo.html Example return array from getAddress(), showing the structure with lat, lng, street, zip, city, and additional fields. ```php [ 'lat' => 50.0805069, 'lng' => 8.2508677, 'street' => 'Blumenstrass 2', 'zip' => '65189', 'city' => 'Wiesbaden', ... ] ``` -------------------------------- ### Example call from a test script for getBasicAuth() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/request.html Shows how to send a request with basic auth credentials in the URL. ```php echo file_get_contents('https://username:password@www.testsite.com'); ``` -------------------------------- ### nn\t3::Request()->GET() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/request.html Sends a GET request via curl. Accepts URL, query parameters, and headers. Returns an array. ```php \nn\t3::Request()->GET( 'https://...', ['a'=>'123'] ); \nn\t3::Request()->GET( 'https://...', ['a'=>'123'], ['Accept-Encoding'=>'gzip, deflate'] ); ``` -------------------------------- ### OK Method Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/message.html Emits an 'OK' flash message. Returns void. ```php \nn\t3::Message()->OK('Title', 'Infotext'); ``` -------------------------------- ### Usage examples for Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/ViewHelpers/Classes/ts.constants.html Shows three ways to call the ViewHelper: with a full path, with a separate key, and with a dynamic key in the path. The return value is mixed. ```Fluid {nnt3:ts.constants(path:'path.zur.constant')} {nnt3:ts.constants(path:'path.zur', key:'constant')} {nnt3:ts.constants(path:'path.{dynamicKey}.whatever')} ``` -------------------------------- ### Get FAL field names from TCA Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/tCA.html Gets all field names from the TCA array that have a SysFileReference relation. For example, for the 'tt_content' table, this would be 'assets', 'media', etc. ```php \nn\t3::TCA()->getColumns( 'pages' ); // => ['media', 'assets', 'image'] ``` -------------------------------- ### Complete Encryption and Decryption Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/encrypt.html Shows a full workflow: encrypt an array and a string, then decrypt and access the values. ```php $encryptedResult = \nn\t3::Encrypt()->encode( ['password'=>'mysecretsomething'] ); echo \nn\t3::Encrypt()->decode( $encryptedResult )['password']; $encryptedResult = \nn\t3::Encrypt()->encode( 'some_secret_phrase' ); echo \nn\t3::Encrypt()->decode( $encryptedResult ); ``` -------------------------------- ### Get current FE user as ViewHelper Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/frontendUser.html Fluid ViewHelper usage to get the current FE user. The second example assigns the result to a variable 'feUser' using f:variable.set. ```fluid {nnt3:frontendUser.get(key:'first_name')} ``` ```fluid {nnt3:frontendUser.get()->f:variable.set(name:'feUser')} ``` -------------------------------- ### \nn\t3::Environment()->isLocalhost() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/environment.html Check if installation is running on local server ```APIDOC ## \nn\t3::Environment()->isLocalhost() ### Description Check if installation is running on local server ### Method Environment::isLocalhost() ### Endpoint \nn\t3::Environment()->isLocalhost() ### Parameters None ### Request Example ```php \nn\t3::Environment()->isLocalhost() ``` ### Response #### Success Response - **boolean** - True if running on local server, false otherwise. #### Response Example ``` true ``` ``` -------------------------------- ### Get folder of a file Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/file.rst.txt Returns the folder to a file. Example shows the returned folder path. ```php \nn\t3::File()->getFolder('fileadmin/test/example.txt'); // ==> return 'fileadmin/test/' ``` -------------------------------- ### nn\t3::Obj()->get() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/obj.html Alias to accessSingleProperty(). Accesses a value in the object using the key. ```php \nn\t3::Obj()->get( $obj, 'title' ); \nn\t3::Obj()->get( $obj, 'falMedia' ); \nn\t3::Obj()->get( $obj, 'fal_media' ); ``` -------------------------------- ### \nn\t3::Fal()->createFalFile() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/fal.html Creates a File (FAL) Object (sys_file) from a source file. Can also handle YouTube/Vimeo URLs. ```APIDOC ## \nn\t3::Fal()->createFalFile() ### Description Creates a File (FAL) Object (sys_file) from a source file. Can also handle YouTube/Vimeo URLs. ### Method createFalFile ### Parameters - **$storageConfig** (string) - Required - Path/folder where FAL file should be stored (e.g. 'fileadmin/projectdata/'). - **$srcFile** (string) - Required - Source file to be converted to FAL (e.g. 'uploads/tx_nnfesubmit/example.jpg'). Can also be URL to YouTube/Vimeo video (e.g. https://www.youtube.com/watch?v=7Bb5jXhwnRY). - **$keepSrcFile** (boolean) - Optional - Copy source file only, not move it? Defaults to false. - **$forceCreateNew** (boolean) - Optional - Should new file always be created? If not, it returns existing File object if necessary. Defaults to false. ### Request Example ```php nnt3::Fal()->createFalFile( $storageConfig, $srcFile, $keepSrcFile, $forceCreateNew ); ``` ### Response #### Success Response - **return** (\Nng\Nnhelpers\Domain\Model\File|\TYPO3\CMS\Core\Resource\File|boolean) - The created File object or false on failure. ``` -------------------------------- ### getPublicUrl Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Gets the path to a file relative to the TYPO3 installation directory (PATH_site). Can handle all types of objects. ```APIDOC ## getPublicUrl ### Description Gets path to file, relative to Typo3 installation directory (PATH_site). Can handle all types of objects. ### Method nn\t3::File()->getPublicUrl() ### Parameters - **$obj** (mixed) - Optional - The file object (e.g., \TYPO3\CMS\Core\Resource\FileReference, \TYPO3\CMS\Extbase\Domain\Model\FileReference, \TYPO3\CMS\Core\Resource\Folder). - **$absolute** (boolean) - Optional - Whether to return an absolute URL. Defaults to false. ### Example ``` nn\t3::File()->getPublicUrl( $falFile ); // \TYPO3\CMS\Core\Resource\FileReference. nn\t3::File()->getPublicUrl( $fileReference ); // \TYPO3\CMS\Extbase\Domain\Model\FileReference nn\t3::File()->getPublicUrl( $folder ); // \TYPO3\CMS\Core\Resource\Folder nn\t3::File()->getPublicUrl( $folder, true ); // https://.../fileadmin/bild.jpg ``` ### Return Value - **string** - The public URL or path. ``` -------------------------------- ### createSysFile() Usage Examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/fal.html Examples of creating a new sys_file entry. Searches all sys_file_storage entries to see if the path already exists as storage; if not, a new storage is created. ```php \nn\t3::Fal()->createSysFile( 'fileadmin/image.jpg' ); \nn\t3::Fal()->createSysFile( '/var/www/mysite/fileadmin/image.jpg' ); ``` -------------------------------- ### \nn\t3::Environment()->getBaseURL() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/environment.html Returns the baseUrl (config.baseURL), including the http(s) protocol, e.g., https://www.webseite.de/. Takes no parameters and returns a string. ```APIDOC ## \nn\t3::Environment()->getBaseURL() ### Description Returns the baseUrl (config.baseURL), including http(s) protocol. ### Method Environment method ### Parameters None ### Request Example ```php \nn\t3::Environment()->getBaseURL(); ``` ### Response #### Success Response - Returns a string containing the base URL. `@return string` ``` -------------------------------- ### Parse class information Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/AdditionalClasses/Classes/documentationHelper.rst.txt Example of using parseClass() to get info about a specific class by passing the class name. ```php \Nng\Nnhelpers\Helpers\DocumentationHelper::parseClass( \Nng\Classes\MyClass::class ); ``` -------------------------------- ### \nn\t3::Fal()->createSysFile($file, $autoCreateStorage = true) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/fal.html Creates a system file record. ```APIDOC ## \nn\t3::Fal()->createSysFile($file, $autoCreateStorage = true) ### Description Creates a system file record. ### Method createSysFile ### Parameters - **$file** (string) - Required - The file path. - **$autoCreateStorage** (bool) - Optional - Whether to auto-create storage. ``` -------------------------------- ### \nn\t3::File()->createFolder($path = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Creates a folder at the given path, including any necessary parent directories. ```APIDOC ## \nn\t3::File()->createFolder($path = NULL) ### Description Creates a folder at the given path, including any necessary parent directories. ### Method createFolder ### Parameters - **$path** (string) - Optional - The path of the folder to create. ### Return Value - **bool** - True on success, false on failure. ``` -------------------------------- ### Get session data Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/frontendUser.html Returns session data for FE users. The example retrieves data for the key 'shop'. ```php \nn\t3::FrontendUser()->getSessionData('shop') ``` -------------------------------- ### getMergedSettings: Merge TypoScript setup with FlexForm Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets merged TypoScript setup for a plugin and its flexform. Specify $extensionName only when fetching a foreign extension's setup or when there is no controller context (e.g., from backend), otherwise FlexForm values are not taken into account. $ttContentUidOrSetupArray can be a tt_content uid or an array to overwrite values. Returns an array. ```php \nn\t3::Settings()->getMergedSettings(); \nn\t3::Settings()->getMergedSettings( 'nnsite' ); \nn\t3::Settings()->getMergedSettings( $extensionName, $ttContentUidOrSetupArray ); ``` -------------------------------- ### createForModel method examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/fal.rst.txt Examples of using \nn\t3::Fal()->createForModel() to convert a file to a FileReference and prepare it for attach() to a model. The FileReference is not attached automatically. ```php \nn\t3::Fal()->createForModel( $model, $fieldName, $filePath ); \nn\t3::Fal()->createForModel( $model, 'image', 'fileadmin/user_uploads/image.jpg' ); \nn\t3::Fal()->createForModel( $model, 'image', ['publicUrl'=>'fileadmin/user_uploads/image.jpg'] ); \nn\t3::Fal()->createForModel( $model, 'image', ['publicUrl'=>'fileadmin/user_uploads/image.jpg', 'title'=>'Title...'] ); ``` -------------------------------- ### nn\t3::Obj()->getClassSchema() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/obj.html Get info about the classSchema of a model. Accepts a model class name or an instance. ```php \nn\t3::Obj()->getClassSchema( $myModel\Name::class ); \nn\t3::Obj()->getClassSchema( $myModel ); ``` -------------------------------- ### \nn\t3::Registry()->pluginGroup($vendorName = '', $groupLabel = '', $plugins = []) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/registry.rst.txt Simplifies the process of registering a list of plugins, which are combined into a group. ```APIDOC ## \nn\t3::Registry()->pluginGroup($vendorName = '', $groupLabel = '', $plugins = []) ### Description Simplifies the process of registering a list of plugins, which are combined into a group. ### Method pluginGroup ### Parameters - **$vendorName** (string) - Optional - The vendor name of the plugins. - **$groupLabel** (string) - Optional - The label for the plugin group. - **$plugins** (array) - Optional - An array of plugin configurations. ### Response #### Success Response - **@return** (void) - No return value. ``` -------------------------------- ### nn\t3::Request()->files() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/request.html Get all file info from $_FILES. The forceArray parameter forces array return. ```php \nn\t3::Request()->files(); \nn\t3::Request()->files( true ); // force array ``` -------------------------------- ### \nn\t3::FrontendUser()->login($username, $password = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/frontendUser.html Logs in a frontend user with the given credentials. ```APIDOC ## \nn\t3::FrontendUser()->login($username, $password = NULL) ### Description Logs in a frontend user with the provided username and password. ### Method POST ### Endpoint \nn\t3::FrontendUser()->login($username, $password = NULL) ### Parameters #### Request Body - **$username** (string) - Required - The username of the frontend user. - **$password** (string) - Optional - The password of the frontend user. If not provided, the password from the request may be used. ### Response Returns true on success, false on failure. ``` -------------------------------- ### Get relative path in storage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/file.rst.txt Returns the relative path of a file to the specified storage. Example shows the returned relative path. ```php \nn\t3::File()->getRelativePathInStorage('fileadmin/media/image.jpg', $storage); // ==> returns 'media/image.jpg' ``` -------------------------------- ### Usage of ViewHelper Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/ViewHelpers/Classes/ts.extConf.html Two examples of using the ViewHelper to retrieve extension configuration. The first uses the 'path' argument to specify the full path, and the second uses both 'path' and 'key' arguments. The ViewHelper returns a mixed value. ```typoscript {nnt3:ts.extConf(path:'nnfiletransfer.pathLogo')} {nnt3:ts.extConf(path:'nnfiletransfer', key:'pathLogo')} ``` -------------------------------- ### Get link to action/controller with nn\t3::Page()->getActionLink() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/page.html Generates a link to a specific action/controller. The example shows usage for the news extension. ```php \nn\t3::Page()->getActionLink( $pid, $extName, $pluginName, $controllerName, $actionName, $args ); ``` ```php $newsArticleUid = 45; $newsDetailPid = 123; \nn\t3::Page()->getActionLink( $newsDetailPid, 'news', 'pi1', 'News', 'detail', ['news'=>$newsArticleUid]); ``` -------------------------------- ### nn\t3::File()->resolvePathPrefixes() examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Resolves EXT: prefix to a relative path. The $absolute parameter can be used to get an absolute path. ```php \nn\t3::File()->resolvePathPrefixes('EXT:extname'); => /typo3conf/ext/extname/ \nn\t3::File()->resolvePathPrefixes('EXT:extname/'); => /typo3conf/ext/extname/ \nn\t3::File()->resolvePathPrefixes('EXT:extname/image.jpg'); => /typo3conf/ext/extname/image.jpg \nn\t3::File()->resolvePathPrefixes('1:/uploads/image.jpg', true); => /var/www/website/fileadmin/uploads/image.jpg ``` -------------------------------- ### nnt3:ts.setup Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/ViewHelpers/Classes/ts.setup.html Retrieves a value from the TypoScript setup using a path. The path can be a simple dot-separated path or include dynamic keys using curly braces. ```APIDOC ## nnt3:ts.setup ### Description Get value from the TypoScript setup. Easy and direct access from within the fluid template - regardless of the extension rendering the template. ### Usage ``` {nnt3:ts.setup(path:'path.to.typoscript.setup')} {nnt3:ts.setup(path:'path.zum.typoscript', key:'setup')} {nnt3:ts.setup(path:'path.zum.typoscript.{dynamicKey}.whatever')} ``` ### Parameters - **path** (string) - Required - The path to the TypoScript setup value, using dot notation. Dynamic keys can be included using curly braces. - **key** (string) - Optional - The key to use for the setup. Defaults to 'setup'. ### Return Value - **mixed** - The value from the TypoScript setup. ``` -------------------------------- ### getVariables: Get view variables in ViewHelper and controller Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/template.html Gets the variables of the current view, i.e., everything set via assign() and assignMultiple(). Returns an array. Two usage examples are shown: one in a ViewHelper context and one in a controller context. ```php \nn\t3::Template()->getVariables( $renderingContext ); ``` ```php \nn\t3::Template()->getVariables( $this->view ); ``` -------------------------------- ### redirect method examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/http.html Examples of using \nn\t3::Http()->redirect() to redirect to a page or URL. The method accepts a page ID or URL, optional query parameters, and an optional variable prefix. The examples show redirecting to an external URL, to a page ID, and with query parameters and a prefix. ```php \nn\t3::Http()->redirect( 'https://www.99grad.de' ); \nn\t3::Http()->redirect( 10 ); // => path/to/pageId10 \nn\t3::Http()->redirect( 10, ['test'=>'123'] ); // => path/to/pageId10&test=123 \nn\t3::Http()->redirect( 10, ['test'=>'123'], 'tx_myext_plugin' ); ``` -------------------------------- ### createFalFile() Usage Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/fal.html Example of creating a FAL File object (sys_file) from a source file or URL. Parameters include storage config, source file, keep source file flag, and force create new flag. ```php nnt3::Fal()->createFalFile( $storageConfig, $srcFile, $keepSrcFile, $forceCreateNew ); ``` -------------------------------- ### getMergedSettings method usage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/settings.rst.txt Gets merged TypoScript setup for a plugin and its flexform. Specify $extensionName only if fetching a foreign extension or when there is no controller context. ```php \nn\t3::Settings()->getMergedSettings(); \nn\t3::Settings()->getMergedSettings( 'nnsite' ); \nn\t3::Settings()->getMergedSettings( $extensionName, $ttContentUidOrSetupArray ); ``` -------------------------------- ### Parse single PHP file Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/AdditionalClasses/Classes/documentationHelper.rst.txt Example of using parseFile() to get all info about a single PHP file, including class and method annotations. ```php \Nng\Nnhelpers\Helpers\DocumentationHelper::parseFile( 'Path/Classes/MyClass.php' ); ``` -------------------------------- ### \nn\t3::Environment()->getExtConf($ext = 'nnhelpers', $param = '') Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/environment.html Gets configuration from `ext_conf_template.txt` (backend, extension configuration). Takes optional extension name and parameter name and returns mixed. Also acts as a ViewHelper. ```APIDOC ## \nn\t3::Environment()->getExtConf($ext = 'nnhelpers', $param = '') ### Description Get configuration from `ext_conf_template.txt` (backend, extension configuration). Also acts as a ViewHelper. ### Method Environment method ### Parameters - **$ext** (string) - Optional - The extension key, default 'nnhelpers'. - **$param** (string) - Optional - The configuration parameter name. ### Request Example ```php \nn\t3::Environment()->getExtConf('nnhelpers', 'varname'); ``` ### ViewHelper Usage ``` {nnt3:ts.extConf(path:'nnhelper')} {nnt3:ts.extConf(path:'nnhelper.varname')} {nnt3:ts.extConf(path:'nnhelper', key:'varname')} ``` ### Response #### Success Response - Returns the configuration value (mixed). `@return mixed` ``` -------------------------------- ### mkdir Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Creates a folder. ```APIDOC ## mkdir ### Description Create a folder. ### Method nn\t3::File()->mkdir() ### Parameters - **$path** (string) - Optional - The path of the folder to create. ### Example ``` nn\t3::File()->mkdir( 'fileadmin/my/folder/' ); nn\t3::File()->mkdir( '1:/my/folder/' ); ``` ### Return Value - **boolean** - True on success, false on failure. ``` -------------------------------- ### Create a folder Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/file.rst.txt Creates a folder at the specified path. Supports both fileadmin and storage paths. ```php \nn\t3::File()->mkdir( 'fileadmin/my/folder/' ); \nn\t3::File()->mkdir( '1:/my/folder/' ); ``` -------------------------------- ### getApiKey() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/geo.html Shows how to get the API key by initializing Geo with a custom key or an array containing the key, then calling getCoordinates(). ```php \nn\t3::Geo( $myApiKey )->getCoordinates('Blumenstrasse 2, 65189 Wiesbaden'); \nn\t3::Geo(['apiKey'=>$myApiKey])->getCoordinates('Blumenstrasse 2, 65189 Wiesbaden'); ``` -------------------------------- ### buildUri method examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/http.html Examples of using \nn\t3::Http()->buildUri() to generate URIs. The method works in both frontend and backend contexts and takes into account realURL. The first example builds a URI for page ID 123, the second adds query parameters and requests an absolute URL. ```php \nn\t3::Http()->buildUri( 123 ); \nn\t3::Http()->buildUri( 123, ['test'=>1], true ); ``` -------------------------------- ### Get TypoScript Setup outside of Controller (nnhelpers) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/SideBySide/Index.html Simplified approach using nnhelpers to retrieve a TypoScript setting value with a single line of code. ```php $value = \nn\t3::Settings()->get('my_ext_table', 'demo.path'); ``` -------------------------------- ### WARNING Method Example Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/message.html Emits a 'WARNING' flash message. Returns void. ```php \nn\t3::Message()->WARNING('Title', 'Infotext'); ``` -------------------------------- ### nn\t3::Obj()->getMethodArguments() usage examples Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/obj.html Get info about the arguments to a method. Takes into account typehinting specified by @param, e.g. ObjectStorage. ```php \nn\t3::Obj()->getMethodArguments( \My\Model\Name::class, 'myMethodName' ); \nn\t3::Obj()->getMethodArguments( $myClassInstance, 'myMethodName' ); ``` -------------------------------- ### \nn\t3::File()->mkdir($path = '') Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/file.html Creates a directory at the given path, including any necessary parent directories. ```APIDOC ## \nn\t3::File()->mkdir($path = '') ### Description Creates a directory at the given path, including any necessary parent directories. ### Method mkdir ### Parameters - **$path** (string) - Optional - The directory path to create. ### Return Value - **bool** - True on success, false on failure. ``` -------------------------------- ### nn\t3::Settings()->getMergedSettings($extensionName = NULL, $ttContentUidOrSetupArray = []) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/settings.html Gets merged settings from TypoScript setup for a plugin and its flexform. Returns the TypoScript array `plugin.tx_extname.settings`. ```APIDOC ## getMergedSettings($extensionName = NULL, $ttContentUidOrSetupArray = []) ### Description Gets merged settings from TypoScript setup for a plugin and its flexform. Returns the TypoScript array `plugin.tx_extname.settings`. Important: specify `$extensionName` only if the setup of a foreign extension is to be fetched or there is no controller context, because the call is made from the backend... otherwise the FlexForm values will not be taken into account! In the FlexForm use ``! | `` then overwrite `settings.varName` in the TypoScript setup. ### Method `getMergedSettings` ### Parameters - `$extensionName` (string) - Optional - The extension key. - `$ttContentUidOrSetupArray` (mixed) - Optional - Can be a uid of a `tt_content` content element or a simple array to overwrite the values from the TypoScript / FlexForm. ### Return `array` ### Example ```php \nn\t3::Settings()->getMergedSettings(); \nn\t3::Settings()->getMergedSettings( 'nnsite' ); \nn\t3::Settings()->getMergedSettings( $extensionName, $ttContentUidOrSetupArray ); ``` ``` -------------------------------- ### \nn\t3::Settings()->getStoragePid($extName = NULL) Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/settings.rst.txt Gets the current (FIRST) StoragePid for the current plugin. The value is stored in the extension's TypoScript setup or FlexForm. ```APIDOC ## \nn\t3::Settings()->getStoragePid($extName = NULL) ### Description Get current (FIRST) StoragePid for the current plugin. Stored in the extension's TypoScript setup under `plugin.tx_extname.persistence.storagePid` or in the FlexForm of the plugin on the respective page. IMPORTANT: Merge with selected StoragePID from the FlexForm only happens if `$extName` is left blank. ### Method Callable method on the \nn\t3::Settings() helper class. ### Parameters - **$extName** (string) - Optional - The extension name. If left blank, merges with FlexForm StoragePID. ### Request Example ```php \nn\t3::Settings()->getStoragePid(); // 123 \nn\t3::Settings()->getStoragePid('nnsite'); // 466 ``` ### Response #### Success Response - **@return** (string) - The StoragePid value. ``` -------------------------------- ### \nn\t3::Environment()->getDomain() Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/environment.html Gets the domain, e.g., www.webseite.de. Takes no parameters and returns a string. ```APIDOC ## \nn\t3::Environment()->getDomain() ### Description Get the domain. ### Method Environment method ### Parameters None ### Request Example ```php \nn\t3::Environment()->getDomain(); ``` ### Response #### Success Response - Returns a string containing the domain. `@return string` ``` -------------------------------- ### Get path of a file Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/file.rst.txt Returns the path of a file based on a filename and storage. The first example uses a storage object, the second uses a fileadmin path. ```php \nn\t3::File()->getPath('media/image.jpg', $storage); // ==> returns '/var/www/.../fileadmin/media/image.jpg'. ``` ```php \nn\t3::File()->getPath('fileadmin/media/image.jpg'); // ==> returns '/var/www/.../fileadmin/media/image.jpg' toück ``` -------------------------------- ### Parse annotations filtered by namespace Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/AdditionalClasses/Classes/annotationHelper.html Fetches only annotations that start with a given namespace, e.g., '@nn\rest'. The example shows both a single namespace string and an array of namespaces. ```php \Nng\Nnhelpers\AnnotationHelper::parse( '...', 'nn\rest' ); \Nng\NnhelpersHelpersAnnotationHelper::parse( '...', ['nn\rest', 'whatever'] ); ``` -------------------------------- ### Create a link to a news detail page with getActionLink Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/_sources/Helpers/Classes/page.rst.txt Creates a link to a news detail page using a plugin. The example sets up a news article UID and detail page ID, then passes them to the method. The link is generated with the plugin 'News', action 'detail', and controller 'pi1'. ```php $newsArticleUid = 45; $newsDetailPid = 123; \nn\t3::Page()->getActionLink( $newsDetailPid, 'news', 'pi1', 'News', 'detail', ['news'=>$newsArticleUid]); ``` -------------------------------- ### nn\t3::Page()->getSiteRoot() usage Source: https://docs.typo3.org/p/nng/nnhelpers/main/en-us/Helpers/Classes/page.html Gets the PID of the site root(s). Corresponds to the page with the 'globe' icon in backend (page property 'use as start of web page'). ```php \nn\t3::Page()->getSiteRoot(); ```