diff --git a/core/modules/filter/filter.install b/core/modules/filter/filter.install index d7e4d81..49d7fb8 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -53,5 +53,5 @@ function filter_install() { filter_format_save($format); // Set the fallback format to plain text. - variable_set('filter_fallback_format', 'plain_text'); + variable_set('filter_fallback_format', $format->format); } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index aa88264..0a144e5 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -683,6 +683,21 @@ function _filter_list_cmp($a, $b) { } /** + * Sorts an array of filters by filter weight, module, name. + * + * Callback for uasort() within filter_formats(). + */ +function _filter_format_filter_cmp($a, $b) { + if ($a->weight != $b->weight) { + return $a->weight > $b->weight; + } + elseif ($a->module != $b->module) { + return strcmp($a->module, $b->module); + } + return strcmp($a->name, $b->name); +} + +/** * Checks if the text in a certain text format is allowed to be cached. * * This function can be used to check whether the result of the filtering @@ -756,9 +771,10 @@ function filter_list_format($format_id) { $filter_formats = filter_formats(); foreach ($filter_formats as $filter_format) { foreach ($filter_format->filters as $filter_name => $filter) { + $filter['name'] = $filter_name; $filters['all'][$filter_format->format][$filter_name] = (object)$filter; } - + uasort($filters['all'][$filter_format->format], '_filter_format_filter_cmp'); } cache()->set('filter_list_format', $filters['all']); }