Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions conversions/regex.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Upgrades text using simple regular expressions.
*/
function coder_upgrade_upgrade_regex_alter(&$file) {
global $_coder_upgrade_module_name;
$name = $_coder_upgrade_module_name;
cdp("inside " . __FUNCTION__);
$hook = 'regex_simple_changes';
$cur = $file;
Expand Down Expand Up @@ -41,12 +43,48 @@ function coder_upgrade_upgrade_regex_alter(&$file) {
$from[] = "/format_username/";
$to[] = "user_format_name";

// temporarily rename Drupal links so the other regexes dont create false
// theme_html_tag() has been renamed.
$from[] = "/theme_html_tag/";
$to[] = "theme_head_tag";

// hook_page_build() has been replaced: https://api.backdropcms.org/change-records/new-layout-module-implements-drag-drop-model-building-layouts
$from[] = "/" . $name . "_page_build/";
$to[] = $name . "_preprocess_page";

// hook_library() has been renamed.
$from[] = "/" . $name . "_library/";
$to[] = $name . "_library_info";

// hook_library_alter() has been renamed.
$from[] = "/" . $name . "_library_alter/";
$to[] = $name . "_library_info_alter";

// replace special sorting function: https://api.backdropcms.org/change-records/generic-sorting-function-replace-implementations-uasort
$from[] = '/uasort\(\$items, *' . "'element_sort'\)/";
$to[] = 'backdrop_sort($items, array("#weight"))';

// replace special sorting function 2
$from[] = '/uasort\(\$items, *' . "'element_sort_title'\)/";
$to[] = 'backdrop_sort($items, array("#title" => SORT_STRING))';

// replace special sorting function 3
$from[] = '/uasort\(\$items, *' . "'drupal_sort'\)/";
$to[] = 'backdrop_sort($items)';

// replace special sorting function 4
$from[] = '/uasort\(\$items, *' . "'drupal_sort_title'\)/";
$to[] = 'backdrop_sort($items, array("title" => SORT_STRING))';

// replace special sorting function 5
$from[] = '/uasort\(\$items, *' . "'admin_bar_element_sort'\)/";
$to[] = 'backdrop_sort($items, array("#weight" => SORT_NUMERIC, "#title" => SORT_STRING))';

// temporarily rename Drupal links so the other regexes don't create false
// links.
$from[] = "/drupal\.org/";
$to[] = "mothershiporg";

// change Drupal to Backdrop throughtout.
// change Drupal to Backdrop throughout.
$from[] = "/drupal/";
$to[] = "backdrop";

Expand Down