TYPO3 Neos - Access Media Management files through TypoScript? - typo3

is it possible to access files uploaded in the media management using typoscript in TYPO3 Neos?
I'm trying to create a site listing all pdfs uploaded by the editors, but I couldn't figure out a way to access these pdfs via typoscript.

It is currently (state of Neos 1.2 beta) not possible to gather a list of assets with the built-in TypoScript objects / Eel helpers. There are two ways to implement your requirement:
Create a plugin that renders the list of PDFs
Create a new TypoScript object or Eel helper to fetch a list of assets
A plugin can be created following the guide on the Neos documentation. If you want to render the list via TypoScript, it's easy to create such a TypoScript object in your own site package:
use TYPO3\Flow\Annotations as Flow;
class AssetCollection extends \TYPO3\TypoScript\TypoScriptObjects\AbstractTypoScriptObject {
/**
* #Flow\Inject
* #var \TYPO3\Media\Domain\Repository\AssetRepository
*/
protected $assetRepository;
public function evaluate() {
return $this->assetRepository->findAll();
}
}
And then use that new object in TypoScript:
prototype(TYPO3.NeosDemoTypo3Org:AssetCollection) {
#class = 'TYPO3\\NeosDemoTypo3Org\\TypoScriptObjects\\AssetCollection'
}
page.body.assets = TYPO3.NeosDemoTypo3Org:AssetCollection

Related

Typo3 6.2 Module: How to add an action to an existing module

I need your help!
Goal:
A Typo3 6.2 module should be extended with a button to delete all user data inserted. By default it is only possible to delete data one-by-one.
Conditions:
no changes in the core data of the original module allowed
I tried the following:
1. Extending the controller with XClasses & adding a new method cleanupAction
Problems with that:
cleanupAction is not allowed
Action would have to be added to ext_tables.php of the original module. But this is not allowed.
2. An own backend module:
Problem with that:
An entry in main nav in backend is generated, which is not desired and not needed.
Do you have any ideas how to tackle the problem? I only want to have an action, which can be called in the backend, without having a main-nav entry.
Thanks for your help!
Set up your own extension, containing a controller, some typoscript setup and a template.
The typoscript is used to change the template of the original backend module to your own version of the template:
module.tx_originalextension.view.templateRootPath = EXT:my_new_extension/Resources/Private/Templates/
Copy all templates from the original extension to your new extension. Add the new "delete all" button where you need it and link it with your new extension controller -> deleteAllAction. Of course, you need to implement the deleteAllAction in your controller.
In your controller, inject the original repository from the original extension, and use it to delete the data.
Remember to check the links in the copied templates. They need to point to the original extension, so add "extensionName" to any f:link.action calls expect the new "deleteAll" link.

Third party plugin not override in joomla

I have created a search plug-in in joomla that is "my-plug-in". When i tried to override this plug-in in joomla templates its not working.If i try to override any existing plug-in joomla its working. I have checked below link as well. This is working
This link
How i override my plug-in in joomla template.
I have added my plug-in below place.
plugins/search/my-plug-in
to
templates/{TEMPLATENAME}/html/plg_search_my-plug-in
If you have thoroughly checked the link that you have given you will find a line "However you can only do it if the plugin is ready to allow overrides. "
and
Joomla provides a mechanism to override a plugin but this feature is not supported by all the plugins. Right now the only plugin in Joomla 3.x core that allow overrides is the Pagenavigation Content plugin that shows previous/next article links in article view of content component. There may be other plugins from third party developers allowing it and more core plugins will be overridable in the future.
Do you have a tmpl folder inside your plugin as quoted here "You will know when a plugin is overridable because has a /tmpl/ folder in it. "
Also have you used JPluginHelper::getLayoutPath(). These are the requirements that need to be completed before you override layouts.
Check this code in pagenavigation plugin
// Output.
if ($row->prev || $row->next)
{
// Get the path for the layout file
$path = JPluginHelper::getLayoutPath('content', 'pagenavigation');
// Render the pagenav
ob_start();
include $path;
$row->pagination = ob_get_clean();
$row->paginationposition = $this->params->get('position', 1);
// This will default to the 1.5 and 1.6-1.7 behavior.
$row->paginationrelative = $this->params->get('relative', 0);
}
They have used JPluginHelper::getLayoutPath(); and you have to use
$path = JPluginHelper::getLayoutPath('search', 'my-plug-in');
You can check the pagenavigation plugin thoroughly to get a good idea.

Joomla Plugin With Helper File

Is there a conventional way of making a helper file to a Joomla Plugin? Like class names (helper or plgNameHelper) and the way of calling it?
class Helper
{
public static function test()
{
// some code
}
public static function anotherTest()
{
// some code
}
}
Conventionally, helper files have been for modules, not plugins. However it is a good idea to make a template, if the plugin changes the page HTML.
There is no conventional way of making a helper file to a Joomla Plugin but you can create Joomla! Library which can help you to auto load your classes by registering prefix.
I suggest you to read this link.

Extbase TYPO3 adding Custom JS Library to Backend Module

I want to use custom JS libraries in my extbase extension. Is it possible to use add_additional footer data api in a backend module controller?
Use a viewhelper in your backend Fluid template:
<f:be.container
addJsFile = "{f:uri.resource(path:'js/script.js')}">
<!-- Content -->
</f:be.container>
UPDATE:
As mentioned by #biesior (thanks!) the method addJsFile is deprecated. Here is an example using the new and recommended be.container viewhelper method includeJsFiles instead. This new function can include multiple JS files instead of just one:
<f:be.container
includeJsFiles = "{0:'{f:uri.resource(path: \'js/script1.js\')}', 1:'{f:uri.resource(path: \'js/script2.js\')}'}" >
<!-- Content -->
</f:be.container>
See the corresponding Fluid viewhelper documentation.

Zend Framework and switching view script paths

I have a problem. Basically, depending on whether a user goes to /es or /br or /cn etc on our website, we have different language template files. So far, we were using a custom templating engine to make this work, but are making a switch over to ZF. I can't seem to figure out how to get ZF to look for a view script in say cn/about-us if the language varuable is cn.
I can't (don't want to) use Zend_Translate for this because we have way too many translated template files and it's just not feasible using Zend_Translate for bazillion different files with multi-paragraphs of Chinese/Korean/Japanese, forgetting for a second that I don't speak those languages.
Can anybody help me?
You can write a controller plugin and use it's routeStartup() method to alter Zend_View settings (path to where your view scripts are located) and change the request uri before routing starts.
class My_Controller_Plugin_LanguageSwitcher extends Zend_Controller_Plugin_Abstract
{
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
// examine the $_SERVER['REQUEST_URI'] and look for your language identifier
// fetch the View and set appropriate view scripts path using setScriptPath() method
// strip the language identifier from your REQUEST_URI
// change the request uri using $request->setRequestUri('your-new-uri-without-the-language- identifier');
}
}