typo3,fluid,extbase,typo3-6.2.x,typo3-extensions , How does my frontend usergroup list get lost between Extbase action controller and Fluid template partial in TYPO3 6.2?


How does my frontend usergroup list get lost between Extbase action controller and Fluid template partial in TYPO3 6.2?

Question:

Tag: typo3,fluid,extbase,typo3-6.2.x,typo3-extensions

I'm using TYPO3 CMS 6.2.12 and Extension Builder 6.2.0 to model a Report class and build an extension to manage it.

One of the domain driven design requirements is that a report author be a logged-in front end user. A second requirement is that the author choose a single group from a list of their front end user groups while entering their report information.

Extension Builder did most of the work in producing code and files, so far. It built the Report model and all the action controllers and Fluid templates and partials. That's a huge leap forward. I did not have it build a model for front end users or their groups, opting instead to inject dependencies from existing classes. I am now trying to work on the user and usergroup requirements, mostly by adding code to the `newAction` controller and the Fluid partial for `FormFields`.

On my development server, I can enter new reports successfully. I bring up a web form for a new report; I can enter information and submit the new report; the newly created report appears in the list page and in the database; and I can show that single report in the web browser.

My problem now is that the frontend usergroup list does not appear in the web form for a new report.

I've been trying a variety of experiments over the last several days.

Today, I ran my most recent test with the code shown here, below. In the TYPO3 back end, I flushed frontend caches and flushed general caches. I went into the Install Tool's "Important actions" and clicked "Clear all cache". It was successful. I then went into the Extension Manager, where I deactivated and reactivated my extension. I then ran Debug in PhpStorm 8.0.3, which followed events. In my development website, I logged in to the front end. I navigated to the report listing page, and clicked "New Report". With break points set in `newAction()`, PhpStorm's watches told me they had an "error evaluating code" for both `$frontendUserRepository` and `$frontendUserGroupRepository`, with no further information that I knew how to find. (I'm new to PhpStorm.) However, `$feUserRepository` became an object of type `TYPO3\CMS\Extbase\Domain\Model\FrontendUser`, containing many items including an `identifierMap` array that contained arrays of `typo3\cms\extbase\domain\model\frontenduser` and `typo3\cms\extbase\domain\model\frontendusergroup` items. The frontenduser array contained a `TYPO3\CMS\Extbase\Domain\Model\FrontendUser` object that contained the correct user record. The frontendusergroup array contained 2 `TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup` objects that contained the correct user group records. In the next debug step, the `TYPO3\CMS\Extbase\Domain\Model\FrontendUser $user` object contained the same correct user record. After all this, though, the output HTML page for the new report's web form produced blanks for my author's username display and my author's usergroup select list. (The Extbase utility debugger showed only irrelevant TypoScript settings.)

This test leads me to believe that the Extbase `newAction` controller can find the frontend usergroups for `$feUserRepository`, but is having trouble with `$frontendUserRepository` and `$frontendUserGroupRepository`. However, indicated by the second empty break tag output line, below, even the `authortest` variable assigned to `$feUserRepository got lost, somehow, on the way to Fluid.

I'm trying for minimal impact on the rest of the package, and what I can find tells me this code below should be working. But it's not.

Can you tell what I missed?

(Please excuse my missing hyperlinks. Stack Overflow is telling me, "You need at least 10 reputation to post more than 2 links. This is my first question, so that obviously hasn't happened, yet.)

From myextension\Classes\Controller\ReportController.php:

/**
 * reportRepository
 * 
 * @var \MyVendor\Myextension\Domain\Repository\ReportRepository
 * @inject
 */
protected $reportRepository = NULL;

/**
 * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
 * @inject
 */
protected $frontendUserRepository;

/**
 * @var \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserGroupRepository
 * @inject
 */
protected $frontendUserGroupRepository;

/**
 * action new
 *
 * @param \MyVendor\Myextension\Domain\Model\Report $newReport
 * @ignorevalidation $newReport
 * @return void
 */
public function newAction(\MyVendor\Myextension\Domain\Model\Report $newReport = NULL) {
    $this->view->assign('newReport', $newReport);
    $this->view->assign('author', $this->frontendUserRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']));
    $this->view->assign('groups', $this->frontendUserGroupRepository->findAll());
    $feUserRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository' );
    $user = $feUserRepository->findByUid( 1 );
    $this->view->assign('authortest', $user);
}

From myextension\Resources\Private\Templates\Report\New.html:

<f:form action="create"  name="newReport" object="{newReport}">
<f:render partial="Report/FormFields" />
<f:form.submit value="Create new" />
</f:form>

From myextension\Resources\Private\Partials\Report\FormFields.html:

<f:debug title="All available variables">{_all}</f:debug>
{author.username}<br />
{authortest.username}<br />
<label for="authorGroupId"><f:translate key="tx_myextension_domain_model_report.author_group_id" /></label><br />
    <f:form.select property="authorGroupId" options="{groups}" optionLabelField="title" optionValueField="uid" /><br />

From HTML output in the web form for a new report:

<br />
<br />
<label for="authorGroupId">Author Group Id</label><br />
    <select name="tx_myextension_myextensionauthorplugin[newReport][authorGroupId]"><option value=""></option>
</select><br />

Answer:

Your variables are not passed to the partial, so {groups} is not a variable inside your Partial.

You can specify the variables you want to use in the partial by giving the attribute arguments on your <f:render.partial> like in your case:

<f:render partial="Report/FormFields" arguments="{groups : groups}" />

Since TYPO3 4.6 you can also use arguments="{_all}" to pass all variables to the partial.

See also:

http://docs.typo3.org/flow/TYPO3FlowDocumentation/stable/TheDefinitiveGuide/PartV/FluidViewHelperReference.html#f-render


Related:


Where are TYPO3 constants from constant editor stored?


typo3,constants
In Typo3 Backend -> Template -> Constants there is a constant editor. Where does TYPO3 saving the constants? Tried an fgrep -ri for an existing pattern, in case of saving to filesystem - no matches. Tried an MySQL search for an existing pattern, in case of saving to DB -...

Display Extbase FileReference with Fluid


typo3,fluid,extbase,typo3-6.2.x
In an extbase extension, I have a FileReference Object. It was created with extension_builder originally. From The Model: /** * apprenticeshipDocument * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference */ protected $apprenticeshipDocument = NULL; etc. In the frontend, <f:debug>{institution.apprenticeshipDocument}</f:debug> gives me this: First Thing: originalResource is missing. Second: When calling {institution.apprenticeshipDocument.uidLocal} directly, the value is...

How to disable cache for a image carousel in TYPO3


caching,typo3,typoscript,extbase,typo3-6.2.x
My TYPO3 extension has a lib that generates random 5 images from the total stock, for example out of the 100 images. This is done randomly every time the page is loaded. Only default the TYPO3 cache is enabled so every time the same 5 images are showed. As the...

Fluid image with extra data for cycle2


typo3,fluid
I'm using cycle2 for a image slider, for adding a title extra data is needed in the image url, so I want to generate the following url: <img src="foto.jpg" data-cycle-title="Title" data-cycle-desc="Subtitle" /> I tried the following but this generates an error? <f:image src="foto.jpg" data-cycle-title="Title" data-cycle-desc="Subtitle" /> ...

Is it possible to set by fluid a argument that the typo3 backend uses as input


typo3,fluid
In the typo3 template I'm using the following line to get the last 5 added items from the backend and this works. <f:cObject typoscriptObjectPath="lib.lastaddeditmes" /> Only the number of item I want to have it flexible and set in the fluid template. So for example like below where the qty...

PHP errors parsing Realurl config file


php,typo3
I have installed the typo3 rearurl extension in Typo3. If I copy to the default manual config location typo3conf/realurl_conf.php a configuration file with for example: <?PHP $TYPO3_CONF_VARS['EXTCONF']['realurl'] = array( '_DEFAULT' => array( ), ); ?> I getting PHP errors like below? Parse error: syntax error, unexpected '$TYPO3_CONF_VARS' (T_VARIABLE) in /home/extension/public_html/typo3conf/realurl_conf.php...

How to assign variable in fluid?


typo3,fluid,view-helpers
I want viewhelper that can be helpful to assign variable in fluid, I dont want variable to be passed from controller.

Typoscript add class to the first element using stdWrap


typo3,typoscript,typo3-6.2.x
I have a custom requirement to display an image slider using TypoScript. The images are taken from default tt_content image content element. I've added the following TypoScript code to implement this; lib.homeslider = COA lib.homeslider { 10 = CONTENT 10 { table = tt_content select { where = colPos =...

Typo3 6.2 fluid pagination not working as expected


typo3,fluid,extbase,typo3-6.2.x,typo3-4.5
My typo3 6.2(Upgraded from Typo3 4.5) fluid paginate displays all the items instead of 5 items. My Repository Method : public function getRandomLocation($iLimit) { $query = $this->createQuery(); $result = $query->statement("Select * FROM tx_sfel_domain_model_ttblocationsproduktegruppen WHERE hidden = 0 AND deleted = 0 AND logo != '' ORDER BY uid LIMIT 0,...

Language detection not working in Typo3 6.2.12


typo3,typoscript,typo3-6.2.x,language-detection
I've a website which has 2 languages: German (de) as default and English (en) as translated. I am trying to implement language detection functionality in the website using the extension "rlmp_language_detection" version 7.0.0. What I want to achieve is, for the countries Austria (at), Switzerland (ch) and Germany (de), the...

How to end typo3 realurl with .html


typo3,realurl
I'm using the realurl extension to make nice urls, only they all end with the / char. How can I let them end like a .html file? /path/to/page/ Would like to have: /path/to/page.html...

TYPO3 Solr extension and facets


solr,typo3,typoscript,typo3-6.2.x
I have a small question about TYPO3 solr facets.At present in my website I have 6 different indexing configuration available. Two of them are custom extension table's and one is tt_news and rest of the 3 are pages table with some custom condition. I managed to add this using additionalWhereClause...

typo3 templavoila check current language


typo3,typoscript,templavoila
Hi i have 4 languages in my typo. Here is my main configuration for them: #LANGS config.linkVars=L config.defaultGetVars.L = 0 config.sys_language_overlay = hideNonTranslated [globalVar = GP:L = 3] config.sys_language_uid = 3 config.language = en config.locale_all = en_EN config.htmlTag_langKey = en plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 3 [globalVar = GP:L = 2] config.sys_language_uid =...

typo3 flow persist updated relation


php,doctrine2,typo3,typo3-flow
I have an issue TYPO3 Flow updating my relations. Am I wrong, that Flow should update changed relations automatically, so I don't have to update the related entities with the respective repository? Example 1: I have a model "Project" with multiple "Job" childs on attribute "jobs". If I do: $project->setJobs($collectionOfJobs);...

How to get Query object to felogin repository?


typo3,typo3-6.1.x
i need Query object of TYPO3\CMS\Felogin\Controller\FrontendLoginController in my extention repository so i can create my own query conditions.

How to get filename in Typo3 solr extension with FAL and own Extbase extension


solr,typo3,extbase,typo3-6.2.x,fal
Before FAL, I can get the filename of an image from my own Extbase extension in the solr config file "typo3/ext/solr/Configuration/TypoScript/Solr/setup.txt" via index { queue { tx_myextension = 1 tx_myextension { fields { ... myimage_stringS = articleimage ... } } } } Where "articleimage" was a database field with the...

Typo3 6.2: “Could not find a suitable type converter for ”String“ ” exeption after update


php,typo3,typo3-6.2.x
Typo3 was from a very old version updated to Typo3 6.2. The most things are working now, but I have one own written extension that give me the following error: Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1297759968: Exception while property mapping at property path "":Could not find a suitable...

How to use Hook “processDatamap_postProcFieldArray” in TYPO3 6.x


php,typo3,extbase,typo3-6.2.x
Use case: When saving an object (in backend, maybe in frontend too later) I want to manipulate values before saving to database. Problem: The file seems to get included (shows an error on save if I choose a wrong file path) but the function does not seem to be executed...

Clean way to switch between typo3 fluid page and action link


typo3,fluid
Is there a more clean way to switch between a page or a action link in fluid based on a var? Now i used the if then statement but this increases a lot of double code lines. See example: <f:if condition="{var}"> <f:then> <f:link.page pageUid="{PageId}"> // a lot of code lines...

TYPO3 extbase create url in repository (not controller)


typo3,extbase
There are good tutorials on how to create URL's in the controllers like this one. Examples are: $this->uriBuilder->reset()->setTargetPageUid($page_uid)->setCreateAbsoluteUri(TRUE)->build(); $this->controllerContext->getUriBuilder()->reset()->setTargetPageUid($page_uid)->setArguments(array('person'=>$person->getUid())->buildFrontendUri(); In works from the controller. But I cannot do the same work in a repository. Error log say that reset() in first example and getUriBuilder in second example is called on...

TYPO3-Upgrade 4.5 to 6.2: namespaces


namespaces,typo3,typo3-6.2.x
I'm updating an old TYPO3 to latest verison 6.2.12. As I do so I replace deprecated classes with the proper namespaces. E.g. t3lib_div to \TYPO3\CMS\Core\Utility\GeneralUtility or t3lib_extmgm to \TYPO3\CMS\Core\Utility\ExtensionManagementUtility. But I cant find the proper namespaced class for t3lib_svbase. Any suggestions? . And I absolutely have no clue what I...

File url [tmp_name] after upload via Typo3 backend


typo3,fluid
I'm building a typo3 extension and in a backend plugin I want to build a image upload form. I seem not to get the correct $_Files url. The following fluid form is used: <f:form action="customerSliderImages" id="customerSliderImages"> <f:form.upload name="custSlider[sliderimage]" /> <f:form.submit value="Upload" /> </f:form> I want to have the [name] and...

Typo3 extbase database query


typo3,extbase,typo3-6.2.x,queryinterface
I have an extbase database query like below. $query = $this->createQuery(); $result = $query->statement("Select * FROM table1 WHERE hidden = 0 AND deleted = 0 AND (".$PublicationYears.") AND logo != '' ORDER BY uid ASC LIMIT 0, ".$iLimit." ")->execute(); return $result; $PublicationYears = "ttra = '12' or ttra = '13'...

userfunc condition for detecting mobile device


typo3,typoscript,typo3-7.x
Since TYPO3 7 the condition 'device' and 'useragent' are deprecated. No I'm looking for a userFunc to use as a condition for detecting mobile devices. My aim is to hide or to show some special pages on mobile devices. I used the extension 'contexts_wurfl' for a while but I guess...

Using FAL in Extbase correctly


typo3,extbase,fal
Domain model class Image extends AbstractContent { /** * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference */ protected $file; /** * Gets the image file * * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference */ public function getFile() { return $this->file; } /** * Sets the image file * * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file * @return void */ public function setFile($file)...

Typoscript CASE & default value


typo3,typoscript
See below for my typoscript code typolink.parameter.cObject = CASE typolink.parameter.cObject { key.field = pid 3725 = TEXT 3725.value = 5574 5515 = TEXT 5515.value = 5574 3748 = TEXT 3748.value = 5574 default = TEXT default.data = pid } What I am trying to implement is , In a CASE...

TYPO3 Extbase build own Sitemap


typo3,sitemap,extbase
There are a lot of sitemap Generators for TYPO3 in the TER available. But none of them can handle Sites created by Extbase, which are not shown in the TYPO3 page tree. Edit Thanks to biesior, detailed informations: Unconventional I switch in TypoScript the GET Parameter for my Extbase extension[globalVar...

Replace URLs in Typo3 DB


mysql,database,typo3
So I have a Site created with Typo3. I also have a domain which is linked to the folder of the Typo3 Installation. www.example.org I created a Subdomain and linked it to the same folder and used the Main Domain for something else. But now everything on the Subdomain still...

htaccess and authentication for multiple domains


.htaccess,typo3
I am running a mutlisite TYPO3-Site. For the pre-live process, I want to add a htaccess with a htpasswd for 3 / 4 sites. How can I configure the htaccess-file to trigger the authentication only for specific urls? For example: http://example.org shouldn't get a password-protection, while http://example2.org should. Both sites...

CSS right sidebar fixed width and left contant fluid


html,css,width,fixed,fluid
I'm trying to add a sidebar which have a fixed width. But the content div should be fluid. Here is my code: .page-main{ padding: 10px; height: auto; overflow: hidden; } .page-content{ background-color: red; width: auto; overflow: hidden; } .page-side { float: right; width: 200px; background-color: green; } <div class="page-main"> <div...

Show Typo3 FlexForm checkbox items inline


typo3
Would it be possible to show the checkboxes inline, so behind each other with a FlexForm? I'm now using the following code, but this shows every setting in a vertical list. <settings.ownchoice_for_sale> <TCEforms> <label>For sale</label> <config> <type>check</type> </config> </TCEforms> </settings.ownchoice_for_sale> <settings.ownchoice_reserved> <TCEforms> <label>Reserved</label> <config> <type>check</type> </config>...

Copy typo3 to a new domain


typo3,typo3-6.2.x
I try to copy a typo3 installtion to a new directory (and new domain), but got some problems I can't figure out where they come from. What I have done is: I copied all the files to the new directory (New domain is mapped to this directory). I copied the...

How can I render preview of FE plugin diplayed in Page module


typo3,backend,extbase,typo3-6.2.x,typo3-extensions
I have developed TYPO3 (6.2) extensions with some FE plugins. I need to change informations about plugin, which is displayed in the backend on page view. Now only Title and name of plugin is displayed ... I have used flexforms for configure the plugin and I would like to show...

Remove default html header with typoscript


typo3,typoscript
I use an own extension which generates the html header and this works fine. Only the default header is still generated, so when we look at the page code there are two htlm headers generated. Even if I use the setting below. Any ideas? page = PAGE page.config { noPageTitle...

google sitemap for tx_news records with dd_googlesitemap_dmf (or alternative)


typo3,sitemap,typo3-6.2.x
I try to let typo3 generate a sitemap for all the news records. For that I tried the dd_googlesitemap_dmf extention. The dd_googlesitemap works (it creates a sitemap for all the typo3 pages - but not for extensions). I filled in the basic infos into the configuration and called the url...

tt_news single view with static news_id


typo3,tt-news
I am using Typo3 Version 6.2 with the plugin tt_news. All I want to do is: Have a simple page on my website On that page I want to have a tt_news single view the news_id of this view should be static (set by me) and NOT by GET variables...

Typoscript USER / USER_INT objects in powermail input fields


typoscript,fluid,extbase,typo3-6.2.x
I've a custom extension to render a value from database. I want to prefill the returned value of the extension using powermail prefill typoscript. But when I add the plugin as userfunction, then it will display strange output in frontend. See my typoscript code below; lib.companyname = USER_INT lib.companyname {...

How does my frontend usergroup list get lost between Extbase action controller and Fluid template partial in TYPO3 6.2?


typo3,fluid,extbase,typo3-6.2.x,typo3-extensions
I'm using TYPO3 CMS 6.2.12 and Extension Builder 6.2.0 to model a Report class and build an extension to manage it. One of the domain driven design requirements is that a report author be a logged-in front end user. A second requirement is that the author choose a single group...

Routes for TYPO3 Neos plugin


typo3,typo3-flow,typo3-neos
I'm trying to define routes for my plugin. Everything is working as it should, because I got pretty URL on output, but unfortunately while I'm trying to access it I get an 404 error with message: #1303209195: No controller could be resolved which would match your request. Package key: "",...

How to get typo3 settings in the utility files?


php,typo3,fluid,extbase
plugin.tx_xxx { setting { storagePid = 23 } } I want this typo3 settings in utility file. Please help me....

Hide typo3 content elements for specific user(groups)


typo3,typoscript
I want to "hide/deactivate" the table element for specific users/usergroups in the typo3 BE. Or to be more clear: I want to ONLY allow it to ONE specific user (admin). How can i do that? NOTE: At the moment the table element is deactivated in the global TS-config via tt_content...