$haystack must of type string error

Created on 1 May 2023, over 1 year ago
Updated 10 May 2023, over 1 year ago

The following error meant I had to uninstall the UI

The website encountered an unexpected error. Please try again later.
TypeError: strpos(): Argument #1 ($haystack) must be of type string, Drupal\Core\Url given in strpos() (line 358 of core/lib/Drupal/Component/Utility/UrlHelper.php).
strpos(Object, ':') (Line: 358)
Drupal\Component\Utility\UrlHelper::stripDangerousProtocols(Object) (Line: 221)
Drupal\Component\Render\FormattableMarkup::placeholderFormat('Users with the Administer libraries permission can edit settings for the custom libraries on the libraries page.', Array) (Line: 195)
Drupal\Core\StringTranslation\TranslatableMarkup->render() (Line: 15)
Drupal\Core\StringTranslation\TranslatableMarkup->__toString() (Line: 24)
libraries_provider_ui_help('help.page.libraries_provider_ui', Object)
call_user_func_array(Object, Array) (Line: 417)
Drupal\Core\Extension\ModuleHandler->invoke('libraries_provider_ui', 'help', Array) (Line: 156)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invoke('libraries_provider_ui', '

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bobburns

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

Comments & Activities

  • Issue created by @bobburns
  • Status changed to Fixed over 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain rodrigoaguilera Barcelona

    Thanks for the report. Can you try the dev version of the module to confirm?

  • πŸ‡ΊπŸ‡ΈUnited States bobburns

    It now enables without error, but I still get

    Drupal\libraries\ExternalLibrary\Exception\LibraryDefinitionNotFoundException: The library definition for the library 'caret.js' could not be found. in Drupal\libraries\ExternalLibrary\Definition\ChainDefinitionDiscovery->getDefinition() (line 56 of modules/libraries/src/ExternalLibrary/Definition/ChainDefinitionDiscovery.php).
    Drupal\libraries\ExternalLibrary\LibraryManager->load('caret.js') (Line: 293)
    atjs_requirements('runtime') (Line: 52)
    Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler::Drupal\hook_event_dispatcher\{closure}(Object, 'atjs') (Line: 405)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith('requirements', Object) (Line: 67)
    Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith('requirements', Object) (Line: 59)
    Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAll('requirements', Array) (Line: 109)
    . . . more

    I am trying to figure out how to use a library from the local filesystem as the readme says

    Currently the module implements a plugin for the JsDelivr CDN
    and another for local libraries in the `/libraries` folder.

    I have this in my module.libraries.yml

    drupal.caret.js
    remote: http://ichord.github.com/Caret.js
    repo: ichord/Caret.js
    description: "Add Github like mentions autocomplete to your application."
    version: 0.3.1
    license:
    name: MIT
    gpl-compatible: true
    js:
    /libraries/caret.js/dist/js/jquery.caret.min.js: {}
    /libraries/caret.js/dist/js/jquery.caret.js: { minified: true }

    libraries_provider:
    enabled: true
    source: LibrarySourceBase

    dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings
    - core/once

    Do I have something wrong in the source syntax or call or way off base elsewhere ??

  • πŸ‡ͺπŸ‡ΈSpain rodrigoaguilera Barcelona

    That seems like an exception for the "libraries" module, not this one.

    I don't understand the line where you specify LibrarySourceBase as the source.
    For an example you can look at bulmajs library definition:
    https://git.drupalcode.org/project/drulma/-/blob/2.x/drulma.libraries.ym...

  • πŸ‡ΊπŸ‡ΈUnited States bobburns

    LibrarySourceBase.php appeared to be the plugin for library discovery

    Going to cdn. jsdelivr.net goes to jsdelivr.com reveals the format for github is gh instead of npm like this

    https://cdn.jsdelivr.net/gh/@ichord/At.js/tree/master/dist/js/jquery.atw... {}

    or something like this

    after several tries of various configurations nothing worked so I will have to wait and see if the libraries maintainers answer

  • πŸ‡ΊπŸ‡ΈUnited States bobburns
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024