i'm adding Sonata mongoDB admin Bundle in my project, after doing all the config, it seems that the bundle works fine but there is a problem it does not display the list of the document which is supposed to display.
when i go to /admin i find the sonata admin template but i got it empty. here is my config.yml :
sonata_block:
default_contexts: [cms]
blocks:
# Enable the SonataAdminBundle block
sonata.admin.block.admin_list:
contexts: [admin]
sonata_doctrine_mongo_db_admin:
templates:
form:
- SonataDoctrineMongoDBAdminBundle:Form:form_admin_fields.html.twig
filter:
- SonataDoctrineMongoDBAdminBundle:Form:filter_admin_fields.html.twig
types:
list:
array: SonataAdminBundle:CRUD:list_array.html.twig
boolean: SonataAdminBundle:CRUD:list_boolean.html.twig
date: SonataAdminBundle:CRUD:list_date.html.twig
time: SonataAdminBundle:CRUD:list_time.html.twig
datetime: SonataAdminBundle:CRUD:list_datetime.html.twig
text: SonataAdminBundle:CRUD:base_list_field.html.twig
trans: SonataAdminBundle:CRUD:list_trans.html.twig
string: SonataAdminBundle:CRUD:base_list_field.html.twig
smallint: SonataAdminBundle:CRUD:base_list_field.html.twig
bigint: SonataAdminBundle:CRUD:base_list_field.html.twig
integer: SonataAdminBundle:CRUD:base_list_field.html.twig
decimal: SonataAdminBundle:CRUD:base_list_field.html.twig
identifier: SonataAdminBundle:CRUD:base_list_field.html.twig
show:
array: SonataAdminBundle:CRUD:show_array.html.twig
boolean: SonataAdminBundle:CRUD:show_boolean.html.twig
date: SonataAdminBundle:CRUD:show_date.html.twig
time: SonataAdminBundle:CRUD:show_time.html.twig
datetime: SonataAdminBundle:CRUD:show_datetime.html.twig
text: SonataAdminBundle:CRUD:base_show_field.html.twig
trans: SonataAdminBundle:CRUD:show_trans.html.twig
string: SonataAdminBundle:CRUD:base_show_field.html.twig
smallint: SonataAdminBundle:CRUD:base_show_field.html.twig
bigint: SonataAdminBundle:CRUD:base_show_field.html.twig
integer: SonataAdminBundle:CRUD:base_show_field.html.twig
decimal: SonataAdminBundle:CRUD:base_show_field.html.twig
and here is my admin.yml (i followed the documentation) :
services:
sonata.admin.question:
class: ATS\AdminBundle\Admin\questionAdmin
tags:
- { name: sonata.admin, manager_type: doctrine_mongodb, group: "Content", label: "Question" }
arguments:
- ~
- ATS\QuizzBundle\Document\Question
- ~
calls:
- [ setTranslationDomain, [ATSAdminBundle]]
and finally here is my questionAdmin class (until here i need only to show the list of my questions stored in the db) :
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
class questionAdmin extends Admin
{
// Fields to be shown on create/edit forms
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('question')
->add('weight')
// ->add('tags')
// ->add('commentsEnabled')
//add custom action links
->add('_action', 'actions', array(
'actions' => array(
'view' => array(),
'edit' => array(),
)
))
;
}
Any one have the solution plz ? thank you
Related
I am trying to remove an input field from the generated email. With Powermail it is relatively easy. There I can exclude fields in the typoscript. How could something like this look with cms-forms?
Example powermail
excludeFromPowermailAllMarker {
# On Confirmation Page (if activated)
confirmationPage {
# add some markernames (commaseparated) which should be excluded
excludeFromMarkerNames = datenschutzbestimmungen, agb
}
}
TYPO3 11.5.12
php 8.1.2
This is possible with the form variants introduced in TYPO3 version 9.
Hide a form element in certain finishers and on the summary step:
type: Form
identifier: test
prototypeName: standard
label: Test
finishers:
-
identifier: EmailToReceiver
options:
subject: Testmail
recipientAddress: tritum#example.org
recipientName: 'Test'
senderAddress: tritum#example.org
senderName: tritum#example.org
renderables:
-
type: Page
identifier: page-1
label: 'Page 1'
renderables:
-
type: Text
identifier: text-1
label: 'Text 1'
variants:
-
identifier: hide-1
renderingOptions:
enabled: false
condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
-
type: Text
identifier: text-2
label: 'Text 2'
-
type: SummaryPage
identifier: summarypage-1
label: 'Summary step'
The relevant part (which disables rendering of the field in the summary page, the email to sender finisher or the email to sender finisher) is
variants:
-
identifier: hide-1
renderingOptions:
enabled: false
condition: 'stepType == "SummaryPage" || finisherIdentifier in ["EmailToSender", "EmailToReceiver"]'
i tried for a few hours to overwrite some parameters in a yaml file of a form with typoscript. I found this passage in the manual:
https://docs.typo3.org/c/typo3/cms-form/9.5/en-us/Concepts/FrontendRendering/Index.html?highlight=formdefinitionoverrides#typoscript-overrides
But i could not get it to work. Additional i could not find a way to debug my yaml definitions. I tried the hint with
typo3/sysext/form/Classes/Mvc/Configuration/ConfigurationManager.php::getConfigurationFromYamlFile()
but this shows only the prototypes not the forms.
So i do have some questions:
is there a possibility to debug the combined code of yaml and typoscript for a form?
does formDefinitionOverrides as described in the manual really work (TYPO3 9.5)
what is ? The identifier of my form in the yaml file or the identifier in the frontend with the number of the content element (myFormIdentifier-UidOfMyContentElement)
is it possible to work with identifiers instead of array indizes? (multiple nested array indizes with up to 10 or more entries driving me crazy.
Thanks!
I found how to use labels instead of using numbered arrays:
the yaml:
type: Form
identifier: test1
prototypeName: standard
renderables:
page1:
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: Step
renderables:
field1:
defaultValue: ''
type: Text
identifier: email-1
label: 'My Email address'
properties:
validationErrorMessages:
-
code: 1221559976
message: öasdlkhfö
and the typoscript:
plugin.tx_form{
settings{
formDefinitionOverrides {
# identifier of form
test1 {
renderables {
# first page of form
page1 {
renderables {
field1 {
label = TEXT
label.value = Eine ganze andere E-Mailaddresse
}
}
}
}
}
}
}
}
works nice, but you cannot mix it - all fileds in one level has to get labels. That makes sense because it is not possible to mix indices and keys in a php array.
Yes, it does work. Here's an example.
The identifier in this example is "myformEN".
With TypoScript you can't do it without this nested array syntax.
TypoScript
plugin.tx_form{
settings{
yamlConfigurations.100 = EXT:user_site/Configuration/Form/CustomFormSetup.yaml
formDefinitionOverrides {
# identifier of form
myformEN {
renderables {
# first page of form
0 {
renderables {
# number of element in form
0 {
# another level (because of "Grid: Row")
renderables {
0 {
defaultValue = TEXT
defaultValue.value = My Text
}
}
}
}
}
}
}
}
}
}
myformEN.form.yaml
renderingOptions:
submitButtonLabel: 'submit'
identifier: myformEN
label: 'Inquiry'
type: Form
prototypeName: standard
[…]
renderables:
-
renderingOptions:
previousButtonLabel: ''
nextButtonLabel: Next
identifier: page-1
label: ''
type: Page
renderables:
-
type: GridRow
identifier: gridrow-1
label: 'Grid: Row'
renderables:
-
defaultValue: 'this will be overwritten by TypoScript'
type: Text
identifier: article
label: Article
-
defaultValue: ''
type: Text
identifier: text-2
label: 'Amount'
[…]
I generated an action with sails generate action task/update-task. I now am trying to create an input parameter that should be an object with optional keys:
inputs: {
fields: {
type: {
body: 'string?',
rruleSetStr: 'string?',
},
required: true,
description: 'All keys are not required, but at least one is'
},
However I keep getting error:
The action `task/update-task` could not be registered. It looks like a machine definition (actions2), but it could not be used to build an action.
Details: ImplementationError: Sorry, could not interpret "task/update-task.js" because its underlying implementation has a problem:
------------------------------------------------------
• Invalid input definition ("fields"). Unrecognized `type`. (Must be 'string', 'number', 'boolean', 'json' or 'ref'. Or set it to a type schema like `[{id:'number', name: {givenName: 'Lisa'}}]`.)
------------------------------------------------------
If you are the maintainer of "task/update-task.js", then you can change its implementation to solve the problem above. Otherwise, please file a bug report with the maintainer, or fork your own copy and fix that.
[?] See https://sailsjs.com/support for help.
at machineAsAction (C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\machine-as-action\lib\machine-as-action.js:271:28)
at helpRegisterAction (C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\sails\lib\app\private\controller\help-register-action.js:63:27)
at C:\Users\Mercurius\Documents\GitHub\Homie-Web\node_modules\sails\lib\app\private\controller\load-action-modules.js:146:13
Does anyone know where the documentation is on how to make optional keys in this? I tried here - http://node-machine.org/spec/machine#inputs - but no luck.
Type must be 'string', 'number', 'boolean', 'json' or 'ref' like error say.
So u need set type to 'ref' (object or array), and u can use custom function for validate.
inputs: {
fields: {
type: 'ref',
custom: function (data) {
// some logic
// example
if (typeof data.body !== "string") {
return false;
// or u can use trow Error('Body is not a string')
}
return true;
},
required: true,
description: 'All keys are not required, but at least one is'
}
Now input is type object and in custom function return false or trow Error('Some problem') break validation.
If u use schema type, just remove ? from your example:
inputs: {
fields: {
type: {
body: 'string',
rruleSetStr: 'string'
},
required: true,
description: 'All keys are not required, but at least one is'
}
This is Runtime (recursive) type-checking for JavaScript., please check documentation for writing rules.
I am migrating from Elasticsearch v2.1 to v6.1.1 and in v2.1 my mappings for dob which worked fine now throws an error.
dob: {
type: 'date',
format: 'strict_date_optional_time||epoch_millis',
term_vector: 'yes',
analyzer: 'ngram_analyzer',
search_analyzer: 'standard',
copy_to: '_all'
}
I now get the following error:
"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [dob] has unsupported parameters: [search_analyzer : standard] [analyzer : ngram_analyzer] [term_vector : yes]"}],"type":"mapper_parsing_exception"
There seems to be an overall problem with date types getting analyzers now. Why is this and how can I solve this problem? Thanks!
As far as I know, these settings have never been supported for date fields. What I suggest you do is to create a text sub-field in your dob field so that you can continue to use your analyzers.
dob: {
type: 'date',
format: 'strict_date_optional_time||epoch_millis',
fields: {
text: {
type: 'text',
term_vector: 'yes',
analyzer: 'ngram_analyzer',
search_analyzer: 'standard',
copy_to: '_all'
}
}
}
Hy,
I've a Problem by sending data via ExtJs Rest Proxy. When I POST Data I get the Exception
in Chrome: Uncaught TypeError: Cannot read property 'clientIdProperty' of undefined
in Firefox: TypeError: clientRecords[0] is undefined
My Store
Ext.define('Test.store.Test', {
extend: 'Ext.data.Store',
requires: [
'Test.model.test',
'Ext.data.proxy.Rest',
'Ext.data.reader.Json'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'Test',
model: 'Test.model.test',
proxy: {
type: 'rest',
url: '/resources/php/test.php',
reader: {
type: 'json'
}
}
}, cfg)]);
}
My Model
Ext.define('Test.model.test', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.Field'
],
fields: [
{
name: 'Test'
}
]
Is there a standard answer from Server?
I hope some one can Help me
Thx for Help
In your reader config, provide a 'root' property.
In ext 4.x it'll be like
reader: {
type: 'json',
root: 'root'
}
And in Ext 5.x, it'll be
reader: {
type: 'json',
rootProperty: 'root'
}
Here's what API doc says -
rootProperty : String The name of the property which contains the data
items corresponding to the Model(s) for which this Reader is
configured. For JSON reader it's a property name (or a dot-separated
list of property names if the root is nested). For XML reader it's a
CSS selector. For Array reader the root is not applicable since the
data is assumed to be a single-level array of arrays.
By default the natural root of the data will be used: the root JSON
array, the root XML element, or the array.
The data packet value for this property should be an empty array to
clear the data or show no data.
Defaults to: ''
For example, if the JSON response from the server is
{
"data": {
"Test": "TEST"
},
"someOtherField": "Some Value"
}
then, your rootProperty/ root will become -
rootProperty: 'data'
- Since data corresponds to your model