Created an extbase extension via Extension Builder.
When a new record is added via frontend, I want it to be disabled (hidden) by default. So an admin can have a look at it first, before publishing it.
Any ideas how to achieve this?
Can't use TCAdefaults, since I only want this to happen for this one extension.
Add the boolean property $hidden to your model with its getter and setter.
You can default it to true in your model.
Or (if you only need it to be true in one action) before you persist your object in your repository, you can $model->setHidden(true).
Related
I want to know how to change/replace the user/contact form in Sulu i.e. https://sulu.rocks/admin/#/contacts/1/details.
I want to remove the fields for Addresses, Bank accounts, etc.
I tried to copy the vendor/sulu/sulu/src/Sulu/Bundle/ContactBundle/Resources/config/forms/account_details.xml into config/forms and removed the unnecessary fields. But that not working.
I can't find something to this in the documentation or it's hidden :D
If you add a form with the exact same key as the form you want to override, the contents of both forms are merged. In your case, the key would be contact_details. Now you can add completely new properties to the form or override existing ones by just creating a property with the same name. If you want to hide a property, you have to override it and set visibleCondition="false".
You can also have a look at this example pull request.
I am looking for a way to add default constraints to a TYPO3 (extbase) repository. I found already the following solution, but this just partly working for me:
https://forum.typo3.org/index.php/t/205096/
With the above solution it is still possible to get an entry in the show view, which looks like this in the controller:
public function showAction(\Vendor\Myext\Domain\Model\User $user)
{
$this->view->assign('user', $user);
}
Is there maybe a way to add more options in "enablecolumns" of the TCA? Or are there other solutions ideas?
When you pass an entity to an action, it does not use your entity Repo at all.
Extbase uses so called TypeConverters, to resolve any data you pass to an action. When you pass an entity/object (via __identity property) the converter performs an own query.
If you want to change the behavior here, you can simply provide your own TypeConverter and register it with a higher priority, than the default PersistentObjectConverter.
I did an extension which does this to provide session based entities. You can see there how to build and register an own converter.
https://bitbucket.org/t--3/extbase_session_entities/src
I have written a small extension that provide news for Backend User.
Ist is just 2 Parts. One part showing the news for all BE User as a own Module, and the other part are create and edit functions provided by the TCA.
To work with the TCA forms and the default extbase getter, i need the correct storagePid. I can't set them via TypoScript, because I'm never in a page context.
My Idea was to use the Plugin settings with the file ext_conf_template.txt
# cat=persistence/enable; type=int; label=Storage pid
storagePid = 4457
But how can I tell TYPO3 to look at this Settings?
At least Repository->findAll() must respect it
Normally you would define this using TypoScript:
module.tx_yourextensionkey.persistence.storagePid = 123
Not being in a page context is not a blocker as long as you place the configuration on the first root TypoScript template (or include the TypoScript via other means which cause global inclusion not specific to any sys_template record or page tree location).
Maybe not the best solution, but it works.
I have written my own function in the repository with the pid as parameter.
I'm using the TYPO3 Query builder.
With $query->equals('pid', $pid); I get entries with my pid.
And with $query->getQuerySettings()->setRespectStoragePage(false); the default pid will be ignored.
And as the last step. My Controller gets the pid from the Settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['my_extension']['storagePid']); an gives it to the function.
I'm currently using TYPO3 6.1.8-dev to build a flux/fluidpages (GitHub Master) powered template and managed to have it running on the root pages, though, I have issues with the sub-pages, in terms of value inheritance.
I've implemented the following scenario:
A Flux Flexform Configuration is used, if there is no TypoScript override variable set, retrieved from TS Setup.
The Flexform fields have the following names:
gridsettings.topRow_use (checkbox)
gridsettings.topRow_cols (select)
After the Flexform Configuration, I use these fields to build the backend grid, after I mix in some static values of a TypoScript configuration with:
{v:iterator.merge(a:'{gridsettings}', b:'{tssettings}') -> v:var.set(name:'gridsettings')}
This works for every page with explicit settings in the page properties, but not for sub-pages, which should just inherit the parents settings.
In the case of sub-pages the gridsettings array is null, and only my TS settings are visible.
I'd like to have the convenience to just create a new sub-page, and add content to the inherited backend-layout grid without any further interaction in the page settings.
How can I solve this issue?
Two parts to this:
1) To solve the problem that you manually must merge TS with FlexForm settings, use the prefix settings. in all your field names. This special, reserved variable name will be used by both Extbase and Fluid without requiring you to transfer it, and your FlexForm settings will be merged (on top of) your TS settings.
2) Inheritance requires the exact same page template on parent and child page, or that child page sets parent decides as option for which template to use. There could be other causes for failing inheritance (for example, the use of default on any of your fields - since you don't include your Flux form structure this is impossible to determine) but mismatching parent/child template is the most common. Also, make sure your Flux is up-to-date; there have been bugfixes recently related to inheritance.
I got two select fields in my symfony project: ContrySelect and StateSelect. They are implemented with the sfDependentSelectPlugin. I just want to know if does it exist a way to listen to the events of the CountrySelect so I can set or unset the StateSelect field.
Thanks in advance.
I only worked once with this plugin.
It has an option for the sfWidgetFormDependentSelect which is called 'ajax'.
See doc:
ajax = false: Specifies whether remote calls are used to populate the
select values,
This may be an option.
Otherwise I would advise you to just create a custom javascript listener on your CountrySelect that will set the other widget.