10 years ago
1
Topic

I'm working on a multilanguages website.

So, i add 2 fields :
- in Article layout : Article association = OK, it works
- in Categorie layout : Category association = problem

Category association only show "articles" instead of categories ! So i can't do all the associations between all my categories. A parameters to change somewhere ?

Get a Book for SEBLOD
10 years ago
0
Level 1

Hi, I can confirm this, reading the code of the jform_associations plugin you can see from line 79 to line 111

// Create Form
$addform = new SimpleXMLElement( '<form />' );
$fields = $addform->addChild( 'fields' );
$fields->addAttribute( 'name', $name );
$fieldset = $fields->addChild( 'fieldset' );
$fieldset->addAttribute( 'name', 'item_associations' );
$fieldset->addAttribute( 'description', 'COM_CONTENT_ITEM_ASSOCIATIONS_FIELDSET_DESC' );
$fieldset->addAttribute( 'addfieldpath', '/administrator/components/ com_content/models/fields' );
$hasForm = false;
foreach ( $languages as $tag=>$language ) {
if ( empty( $config['language'] ) || $tag != $config['language'] ) {
$hasForm = true;
$f = $fieldset->addChild( 'field' );
$f->addAttribute( 'name', $tag );
$f->addAttribute( 'type', ' modal_article' );
$f->addAttribute( 'language', $tag );
$f->addAttribute( 'label', $language->title );
$f->addAttribute( 'translate_label', 'false' );
}
}
$form = JForm::getInstance( $id, $addform->asXML() );
if ( $hasForm ) {
$form->load( $addform, false );
$associations = JLanguageAssociations::getAssociations( ' com_content', '#__content', 'com_content.item', $config['pk'] );
if ( count( $associations ) ) {
foreach ( $associations as $tag=>$association ) {
$form->setValue( $tag, $name, $association->id );
}
}
if ( $config['translate_id'] && isset( $config['translate'] ) ) {
$form->setValue( $config['translate'], $name, $config['translate_id'] );
}
}
As you can see here, right now it is hardcoded to associate just things of the "content" table... Also if you look at the code of the cck_storage_location joomla_category plugin, you will see around the line 323 this: 
// Associations 
// todo
I think this is something that will be developed in the near future but for now is not supported unless you develop your own cck_storage_location and your cck_field plugins...
Get a Book for SEBLOD