How to make MultiValueField with Composite Fields and i18n enabled work properly? - magnolia

Have anyone tried to have a form with MultiValueField in Magnolia having Composite fields with i18n enabled and is working properly?
Currently, I'm encountering some weird behaviour when adding items to English then switching to other language and adding items again then switch back to English with items all gone. In one JIRA post it said it was already fixed but I still encounter this issue. Also encountered issues in sorting which apparently not supported by the DelegatingMultiValueTransformer.
If so, can you please show me the configuration you use to make this work properly? If needed customisation, can you give me ideas on how to do it?
Would really appreciate any help on this.
Btw, I'm using the latest release 5.4.6 now.

Maybe you don't want to put two questions in one request in the future ;)
Re language issue:
did you check that you have i18n enabled also on the subfields, since you are using deletage transformer? AFAIK with delegate you need to have them enabled on all fields in the hierarchy.
Re transformer & ordering:
IMO the only way out is to write custom transformer. Look at source code of MultiValueTransformer and in the part of the code where it goes just two levels down when checking child values, you need to go deeper.
You would also need to define different structure storage for your values there since one used by the MultiValueTransformer would not suffice for multiple levels.
Perhaps you can extend one of the more specialized MultiValue*Transformer or perhaps you try MultiValueJSONTransformer if storing all values in json array is enough for you (you would still need to extend it and to repopulate values back into dialog when opening dialog for editing).
HTH,
Jan

Related

TornadoFX: Label text not updating

One of the issues I'm currently experiencing is that I can't seem to change the text of a Label which is implemented in a dynamically loaded AnchorPane. I assume this might be related to the controller and how JavaFX/TornadoFX works, but I can't seem to find what I'm doing wrong.
The issue itself occurs in this class, and happens in the showSystemDetails() method. What I would expect to happen is that upon pressing the "System Details" button in the sidebar, the labels would update to the required value, but this isn't happening for some reason.
Please feel free to point me to what I'm doing wrong, or provide any constructive criticism. The project is still in full development so a lot of things are still messy/broken.
The reason this isn't working is that you're manually loading a new version of the FMXL file every time you select something in your menu. The FXML file originally loaded by SystemDetailsViewProxy is updated correctly, but that's not the one you're showing on screen anymore.
To see the updated View, make sure you put the root node of the SystemDetailsViewProxy instance back.
You could for example change your DrawerMenuButton enum to contain references to SystemDetailsViewProxy::class instead of those two strings, and use add(viewClass) to add the correct root node to your view when clicking the menu buttons.
Furthermore, you should be using ViewModels and binding instead of manually updating the text property of the labels. You're doing an awful lot of manual/error prone work that the framework can help you with for free.
Your application is not using best practices in several important areas, and you're rolling your own solutions for stuff that the framework already does very well :)
Views are singletons when managed by the framework, but you instantiate them yourself instead of using inject/find. The result is that important life cycle methods are not being called.
I would also suggest looking into type safe builders instead of FXML.
Hope this helps :)

Silverstripe 3 - Force list view of children for one page type

is it possible to force the children of a defined page type always to show as list?
And if yes, who? Can't figure out who to do this.
Thank you in advance
it is possible, however its pretty trick to get it working properly.
It is not only a lot of work to get it done right, it will also bring certain problems with it which you will have to overcome (eg the Preview Split Screen will not work, you will have to apply some custom javascript I think), so consider this carefully.
Have a look at the silverstripe-blogger module, micmania1 has done a pretty good job there.
He uses a GridField to display the blog children (BlogPosts) if you set the config like this:
BlogPost:
show_in_sitetree: false
you can find the module on Packagist and GitHub

user_pictures & user_register variables

I'm trying to pragmatically set those 2 variables upon installing a site.
user_pictures (Disabling user pictures altogether)
user_register (allowing visitors to register without admin)
I'm using Features with strongarm but no luck. Even with the feature enabled the options are wrong in the account settings.
Setting the variable manually with a script doesn't do the trick either, although the options show the correct checkbox as ticked, I still have to to the page a click "save configuration" to confirm the setting.
This goes for maaany other variables I'm tryign to set, and I'm not sure if this is possible but it would be nice.
Thank you!
One solution which only solves part of my problem is to use Install profiles. The problem with those is that some variables still don't seem to take effect or work at all...
https://drupal.org/developing/distributions
https://drupal.org/project/profiler
It looks like this is the intended behavior of the features module, according to this old issue on drupal.org:
Say when developing a site, and set the settings at admin/user/settings for user_register. then you go live, later you decide to change the value, make a feature and strongarm that user_register variable then deploy that. The setting will still be in the database (as a variable), thus the feature is overridden.
The simplest solution is to not rely on features to set your variables on installation. It's much simpler to use hook_install anyway. I suppose we're only supposed to think of the Features module as a means of setting up or updating complicated configuration from the Features administration page, but not when the module itself is enabled or updated.
This will set the variables you describe for the example module:
function example_install() {
variable_set('user_pictures', 0);
variable_set('user_register', 1);
}
If other parts of your feature also aren't being set up correctly, perhaps you should try this instead:
function example_install() {
// This will only revert 'variable' features. Include additional features as needed.
features_revert(array('example' => array('variable')));
}

WP7 - How can I retrieve the mini form of a Path at runtime?

I've got a databound series of predefined shapes (Path with Data="" set) which each trigger the same event when clicked.
I'd like to programmatically access the mini form of the Path.Data property at runtime to be able to persist it.
In this case I could just name the elements and on click check which one, however I'd prefer a more generic solution.
There seem to be some WPF workarounds but I haven't seen any for WP7.
Does anyone know if this is possible? and if so, how to do it?
Thanks.
Looking in to if and how this may be possible I came across http://www.eightyeightpercentnerd.dreamhosters.com/?p=40 and even though it's quite old it explains how a paths data/geometry is parsed in Siverlight.
It leads me to think that you may be better off trying to find a different approach to solving your problem. :(

Is it possible to change the content type on nodes in Drupal 6?

I have inherited a Drupal site on which (for some reason) there are two different content types for news: one for press releases and one for everything else. I would like to combine the two and use a taxonomy to categorize the press releases and other news types.
Is it even possible to do this? The site is using a number of modules, including Views and CCK, and I don't know how much a change like this would affect module data.
http://drupal.org/project/node_convert
The module linked above works extremely well for migrating nodes from one content type to another.
When you are done, you can then use VBO (http://drupal.org/project/views_bulk_operations) to mass manipulate the taxonomy changes you need.
Is it possible? Yes.
Is it easy? No.
To quote a well used phrase:
If it ain't broke, don't fix it.
You can get your site to work like you describe, and if you started with a clean site that you were going to build, it would be no problem. It's just a matter of choice. Now when you do have a database with views, content and other stuff, it wont be easy. You would have to:
Go through all the views, and set them up to use taxonomy and the 1 content type.
Migrate all the data into 1 content type. This might evolve setting up CCK for this content type to fit both, and take this into consideration when migrating the data.
It's possible the content types are used elsewhere, in custom modules, settings etc, these need to be tracked down and fixed as well.
So it's a lot of work with little/no gain.
Of course it's possible. The change won't necessarily be difficult if you've got a good understanding of how each content type is being used. You'll just need to be careful as it's a fundamental change.
If you think that the two different content types are not warranted and it is, in fact duplication of information then you could justify merging the two. Good house keeping!
You could phase out the unwanted content type over time and then when you're confident you've got it just right, build your self a merge module to move the old nodes into the new format. You could also build yourself test views and content types that you can dispose of later.
It may also help to install the devel module to get a programmatic overview of what your nodes look like. You shouldn't leave this module running on live sites as it effects performance.
Sometimes, there's a fair amount of crossover between content taxonomy and content types. It helps to ask yourself: What is a classification of an object and what's an attribute?
It is possible to change the content type of nodes.
The problem is if the content types use different CCK fields, which are present in a content type but not in the other. In such case, if you change the content type, those fields would not appear in the converted node; you should convert all those fields manually, or create a custom module to do that.

Resources