PHP error in Copy Blocks

Created on 21 October 2024, about 2 months ago

Copy blocks generating PHP Error

On Drupal 10.3.6 system with W3CSS Theme V2 (drupal8_w3css_theme) 2.0.14 and the Solo Theme 1.0.11 I am trying to use solo copy blocks. I can get a message that 13 blocks are copied from the W3CSS theme to Solo but I also generate an error in my log file. Here is part of the log message:

Deprecated function: strnatcasecmp(): Passing null to parameter #2 ($string2) of type string is deprecated in Drupal\shortcut\Entity\Shortcut::sort() (line 186 of C:\webpage\compg_6\web\core\modules\shortcut\src\Entity\Shortcut.php)
#0 C:\webpage\compg_6\web\core\includes\bootstrap.inc(166): _drupal_error_handler_real(8192, 'strnatcasecmp()...', 'C:\\webpage\\comp...', 186)
#1 [internal function]: _drupal_error_handler(8192, 'strnatcasecmp()...', 'C:\\webpage\\comp...', 186)
#2 C:\webpage\compg_6\web\core\modules\shortcut\src\Entity\Shortcut.php(186): strnatcasecmp('', NULL)
#3 [internal function]: Drupal\shortcut\Entity\Shortcut::sort(Object(Drupal\shortcut\Entity\Shortcut), Object(Drupal\shortcut\Entity\Shortcut))
#4 C:\webpage\compg_6\web\core\modules\shortcut\src\Entity\ShortcutSet.php(128): uasort(Array, Array)
#5 C:\webpage\compg_6\web\core\modules\shortcut\shortcut.module(212): Drupal\shortcut\Entity\ShortcutSet->getShortcuts()
#6 C:\webpage\compg_6\web\core\modules\shortcut\src\ShortcutLazyBuilders.php(65): shortcut_renderable_links()
#7 [internal function]: Drupal\shortcut\ShortcutLazyBuilders->lazyLinks(

See rest of issue.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fkelly

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @fkelly
  • πŸ‡ΊπŸ‡ΈUnited States fkelly

    There is an extensive discussion (unresolved at this time) at https://www.drupal.org/project/drupal/issues/3280848 πŸ› Shortcut links without a title cause deprecation notices. Needs work

    with regard to the strnatcasecmp() error and I'm not sure if it affects the copy blocks functioning. In fact it doesn't even appear that strnatcasecmp() is even called directly from Copy Blocks. Copy blocks gives me a message that 13 blocks have been copied from w3css theme to solo.

    The latest version of Solo (1.0.11) has the following regions listed in its info.yml file (I truncated the list)

    regions:
      highlighted: 'Highlighted'
      popup_login_block: 'Popup Login Block'
      fixed_search_block: 'Fixed Search Block'
      header: 'Header'
      primary_sidebar_menu: 'Primary Sidebar Menu'

    The latest w3css theme 2.0.14 has the following regions in its info.yml (again truncated);
    regions:
    header: 'Header'
    primary_menu_vertical: 'Primary Menu Vertical'
    primary_menu: 'Primary Menu'
    welcome_text: 'Welcome Text'
    top_first: 'Top First Container'

    This is the code that remains after copy_blocks has run. So, I guess that copy blocks does what it says: copy blocks, but doesn't alter the region layout of a solo based theme to match the old layout of w3css? And the recommendation would be to copy your blocks but don't alter the region layout? Just put your blocks in an appropriated (and equivalent) region in the new solo theme?

  • πŸ‡ΊπŸ‡ΈUnited States fkelly
  • πŸ‡ΊπŸ‡ΈUnited States flashwebcenter Austin TX

    Hello,

    Just put your blocks in an appropriated (and equivalent) region in the new solo theme?

    Yes
    Copy the blocks along with their configurations to the Solo theme..

    Best wishes,
    Alaa

Production build 0.71.5 2024