Sort options for the buttons itemlist

druppi - November 21, 2008 - 11:54
Project:Inline and link Drupal objects (Linodef)
Version:6.x-1.0-rc1
Component:Buttons API
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I changed the code in linodef-editorbuttons-api.inc to meet my needs (field_name list sorted by node id descending to get the latest nodes first, nodes list sorted by title ascending):

<?php
// $result = db_query('SELECT n.%s as value, n.* FROM {%s} n', $fieldvalues['columns']['value']['column'], $fieldvalues['table']);
$result = db_query('SELECT n.%s as value, n.* FROM {%s} n order by n.nid desc', $fieldvalues['columns']['value']['column'], $fieldvalues['table']);
?>

and
<?php
//$output[$i] = array('tag' => "[#". $ergebnis->nid .":". $fieldname .":". $ergebnis->delta ."]", 'desc' => $ergebnis->value ."(". $node->title .")");
$output[$i] = array('tag' => "[#". $ergebnis->nid .":". $fieldname .":". $ergebnis->delta ."]", 'desc' => $ergebnis->value ." (". $node->title .") [#" . $node->nid . "]");
?>

Perhaps an additional parameter can be used to define the sort sequence in future versions?

#1

druppi - November 21, 2008 - 11:57

Sorry, the second was an output modification ;)
Here is the change for node lists:

<?php
//$result = db_query('SELECT n.nid FROM {node} n WHERE n.type = "%s"', $contenttype);
$result = db_query('SELECT n.nid FROM {node} n WHERE n.type = "%s" order by n.title', $contenttype);
?>

#2

Roi Danton - November 21, 2008 - 13:54

Good idea. I think Buttons API should provide an admin form so the admin can set a default sort order for node and field buttons.

Though the disadvantage that you won't be able to set it for every single button is not as big as if the button code would be cluttered with tons of options (in rc2 there will be already three: "button type" will be new).

This will be included in rc3. I want to release rc2 with new tag syntax asap.

EDIT: So you'll have to change it in rc2 again. The file location has changed: linodef/modules/linodef_buttonsapi/includes/linodef_buttonsapi.inc

#3

Roi Danton - December 1, 2008 - 09:06
Title:Sort the popup lists in BuEditor-Button» Sort options for the buttons itemlist
Status:active» fixed

Notwithstanding what I said before this feature is going to be a part of the RC2 release.
I've read your output modification, too and therefore added a title to the buttons. The title contains the tag the current item will insert.

Comitted to D6 branch. Please test the dev release on a test environment for bugs/flaws since with this dev update Linodef got tons of new features. RC2 will be released before Christmas unless major design bugs are found. If you find a bug relating this issue then reactivate it, please. Thx!

#4

System Message - December 15, 2008 - 09:33
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.