I'm working on a site that has about 10 image styles, and I would love it if the image styles list could be organized in a meaningful way. My first thought was to add a weight to each image style (in code) so that the list would come out organized by my weights. Unfortunately, it does not look like the function image_styles()
sorts by weight, or actually by anything at all.
An easy win for developers hoping to organize their image styles would be to add a call to backdrop_sort
in here.
If it were to first sort by weight, then alpha by name, we'd get the default behavior for non-developers to have the styles sorted alphabetically, which might also be a win.
in the function image_styles()
let's change the last few lines like this:
// Sort the styles by weight, then name.
backdrop_sort($styles, array('weight' => SORT_NUMERIC, 'label' => SORT_STRING));
backdrop_alter('image_styles', $styles);
cache()->set('image_styles', $styles);
Recent comments
@laryn - thanks for this. I was looking for the CKEditor media widget that lets you add more than just images, like in Drupal 8+. Never occurred to me that file upload would be under the link widget...
Simple PDF Upload & Link
Awesome, I've unchecked the multifiled settings and now everthings works like a charm! Great work, again thank you very much!
How to show "Repeating dates" on a view page?
Extremely usefulĀ idea and module. Thank you! This may have many other flexible applications in administering website's content and design.
Is it possible to choose a specific layout for each post ?