Created on 4 February 2023, about 2 years ago
Updated 11 February 2023, about 2 years ago

Hello.

How to open link in dialog (modal) with a specific display mode? Is that possible?

πŸ“Œ Task
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΈπŸ‡°Slovakia coaston

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

Comments & Activities

  • Issue created by @coaston
  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

    This module opens any existing path in a dialog.
    Do you have an URL for your display mode? Then use it.
    There are modules that provide such paths, if you don't want to write a .routing.yml.

  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

    Feel welcome to add a documentation page for the module and add that there.

  • πŸ‡ΈπŸ‡°Slovakia coaston

    Hi Geek-Merlin.

    i was not successful with the display mode so I wanted to provide workaround as follow:

    1.Create new view
    2.Add field "Notes"
    3.Add path to page : /mynotes/%
    4.Add Contextual filter to ID (Content ID from URL)

    Now when I open page like : /mynotes/13242 - it opens page

    5.Create new view
    6.Add field like ID, Tittle etc
    7.Go to Title for example > Rewrite results > Output this field as a custom link > /mynotes/{{ nid }}?dialog[type]=modal

    When I hover over mouse to title now I can see the same link :/mynotes/13242 however when I click on it - nothing happens

    When I visit the same link /mynotes/13242 it works fine, however dialog does not work.

    Any idea ?

  • πŸ‡ΈπŸ‡°Slovakia coaston

    I just noticed it gives following error in logs when I click on that "title" which has output as link in dialog :

    Warning: Array to string conversion in Drupal\Component\Render\PlainTextOutput::renderFromHtml() (line 22 of /core/lib/Drupal/Component/Render/PlainTextOutput.php).

  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

    Please always provide a backtrace with error messages. Without, it's useless.

  • πŸ‡ΈπŸ‡°Slovakia coaston

    Thank you for your response...please find attachment.

  • πŸ‡©πŸ‡ͺGermany geek-merlin Freiburg, Germany

    Some custom code tries to PlainText an array where a string is needed. Nothing related to this module.

  • πŸ‡ΈπŸ‡°Slovakia coaston

    Hm I dont have any custom code there..

    I believe you can simply replicate the issue you just need 2 pages in view of the same content and from one page create link as output of the any field with path including the dialog to open the second page.

  • πŸ‡ΈπŸ‡°Slovakia coaston

    Hi Geek-Merlin.

    I just realized that Title is missing because from the content it can take by default, but not from the views, so if I use additional options as follow:

    /mynotes/{{ nid }}?dialog[type]=modal&dialog[options][title]=Hello

    -Now it opens dialog correctly, but still the same php warning message when I check logs, hence it seems I still need any required option which is given by default when we work with content, but it does not work with views page. Do you know which options are required by default?

Production build 0.71.5 2024