I have the "Domain Access" Module (http://drupal.org/project/domain) installed but sorting works only on the main domain.
When I change the order on a 2nd domain it´s ignored.

It would be awesome if multiple Domains would be supported.
Meanwhile I have to create a extra view for every domain.

Comments

ygerasimov’s picture

Status: Active » Fixed

I have implemented Field API handler that can save weights of the nodes to integer fields. Hope this will do the job for your case.

Please reopen this issue if you need to make Native handler working for domain module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ericmulder1980’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

The Field API Handler is a nice addition to the module but i don't think this will provide a solution for the use case mentioned in the OP. Perhaps if i describe the use case in more detail it will be more clear what is needed for this to work.

Take a website that has the domain_access module installed and has two active domains; domainA@example.com and domainB@example.com. On the website there is a content type news that can be published to domainA, domainB or both domains. When a news node is published to both domains you want to be able to set a different sort value for both domains. For example, a news items should be the first on the list for domain A but last on the list for domain B.

I guess the best option is to write a custom Domain aware handler that stores the sorting in the same way as the native handler but has an extra column to store the domain. As i am currently working on a project that needs this i will throw in a patch somewhere this week to be reviewed.

ericmulder1980’s picture

Perhaps there is even a simpler solution to this. I see in the native handler there is an option to use the hook_draggableviews_handler_native_arguments which let's you pass in your own arguments. This makes it easy to include the domain_id for which you want to add the sorting. I'm not sure however how to implement this within the view.

ericmulder1980’s picture

I found a solution and will share it here for others to benefit from.

Implement hook_draggableviews_handler_native_arguments
First thing you need to do is implement the hook to supply additional arguments to draggable views. In my case i need to add the domain_id of the current domain.

function example_draggableviews_handler_native_arguments_alter(&$arguments, $view, &$form_values) {
  global $_domain;
  $arguments['domain_id'] = $_domain['domain_id'];
}

Arguments handling
In both the sortable and sorting view you need to alter the sort criterion configuration. Most likely this is the "DRAGGABLEVIEWS: WEIGHT" sort handler. In the section Arguments handling select the option "Prepare arguments with PHP code" and put the code below in the configuration.

global $_domain;
$arguments['domain_id'] = $_domain['domain_id'];
return $arguments;

Happy sorting!

ericmulder1980’s picture

Component: Code » Documentation
Category: Feature request » Task

Modified this issue to a documentation task because i feel more people would benefit from some documentation based on this use case.