any reason not to add a "sort()" call in create_file_dropdown()?

Talk about new features for CMSMS and modules.
Post Reply
codegrunt
Forum Members
Forum Members
Posts: 12
Joined: Mon Oct 11, 2010 9:24 pm

any reason not to add a "sort()" call in create_file_dropdown()?

Post by codegrunt »

Howdy.  I have just started adding some {content_image} boxes in my templates and noticed that there is no sorting being done for filename lists.  Since that tends to make it harder to find what you are looking for (in larger lists especially), I was curious if anyone can think of a reason NOT to add a "sort()" call to this function?

Code: Select all

function create_file_dropdown($name,$dir,$value,$allowed_extensions,$optprefix='',$allownone=false,$extratext='',
                              $fileprefix='',$excludefiles=1)
{
  $files = array();
  $files = get_matching_files($dir,$allowed_extensions,true,true,$fileprefix,$excludefiles);
  if( $files === false ) return false;
        sort($files); // make filelist easier to read
                     $fileprefix='',$excludefiles=1)
      ...
It looks safe to me as it does not appear to expect any specific array index association but thought I would ask in case I am not seeing something.

Cheers
CODEgrunt Consulting - total geek trash, coder / troubleshooter for hire
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: any reason not to add a "sort()" call in create_file_dropdown()?

Post by Dr.CSS »

No reason...

But you may want to files these under the Feature Request board, and you can submit these as feature request for the core http://dev.cmsmadesimple.org/feature_request/list/6 and you can also talk to the developers on IRC #cms about diff. files for patches...
Post Reply

Return to “Feature ideas”