{"id":56311,"date":"2023-01-03T16:46:06","date_gmt":"2023-01-03T11:16:06","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=56311"},"modified":"2023-01-11T17:03:36","modified_gmt":"2023-01-11T11:33:36","slug":"loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/","title":{"rendered":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour"},"content":{"rendered":"<p>Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you&#8217;ll feed them.<\/p>\n<p>In order to open some link\/node\/page in a modal window, you can add the following structure to the link within React:<\/p>\n<pre>class=\"use-ajax\" data-dialog-type=\"modal\"<\/pre>\n<p>Optionally you can also add <strong>data-dialog-options='{&#8220;width&#8221;:810, &#8220;dialogClass&#8221;: &#8220;modal-react&#8221;}&#8217;<\/strong> to style the modal.<\/p>\n<p>And ultimately, the link will look like this:<\/p>\n<pre>&lt;a\r\n  href=\"\/admin\/content\"\r\n  className=\"use-ajax\"\r\n  data-dialog-type=\"modal\"\r\n  data-dialog-options='{\"width\":810,\"dialogClass\": \"modal-react\"}'\r\n&gt;Dialog link&lt;\/a&gt;<\/pre>\n<h2><strong>Click on this link, and in most cases it will open the dialog.<\/strong><\/h2>\n<p>But if in case the &lt;a&gt; tag is rendered after a few seconds of page load, within a popup, or after some AJAX call, clicking on the link will do nothing. To overcome this, we will use drupal behaviors to Ajaxify the links.<\/p>\n<p>Drupal has a \u201cbehaviors\u201d system to provide a modular and better way for attaching JavaScript functionality to place elements on a page. This Drupal Behavior is the object in JavaScript that Drupal initializes after the page loads and after every AJAX call in DOM.<br \/>\nThis drupal behavior can be called from React, let&#8217;s see how:<\/p>\n<h3>Step 1: Add Drupal Behaviour<\/h3>\n<p>First, we will create drupal behavior and write the code to Ajaxify the link within this. For this, create a file <strong>js\/custom.js<\/strong> and add the following code:<\/p>\n<pre>(function ($, Drupal, drupalSettings) {\r\n  Drupal.behaviors.custom_js = {\r\n    ajaxifyLinks: function () {\r\n      jQuery('.use-ajax:not(.ajax-processed)').addClass('ajax-processed').each(function () {\r\n        var ajaxSettings = {\r\n          url: jQuery(this).attr('href'),\r\n          element: this\r\n        };\r\n        Drupal.attachBehaviors(this, ajaxSettings);\r\n      });\r\n    },\r\n    attach: function (context, settings) {\r\n      \/\/Some JS Code\r\n    }\r\n  }\r\n})(jQuery, Drupal, drupalSettings);<\/pre>\n<p>Since we are getting new content after the page is loaded, once the new content is loaded, we call <strong>Drupal.attachBehaviors()<\/strong> to re-attach any javascript effects to this newly loaded content.<\/p>\n<h3>Step 2: Update our libraries<\/h3>\n<p>Add <strong>custom.js before<\/strong> attaching the <strong>react bundle file<\/strong>. This is to ensure our drupal behavior function <strong>ajaxifyLinks<\/strong> is available when react is loaded.<\/p>\n<pre>react-lib:\r\n  version: 1.x\r\n  js:\r\n    js\/custom.js: {}\r\n    js\/react-app\/dist\/app.bundle.js: { minified: true }<\/pre>\n<h3>Step 3: Call drupal behavior from react<\/h3>\n<p><strong>Drupal.behaviors<\/strong> is a global variable that can be used directly within the React app. custom_js is the behavior name we created in the <strong>custom.js<\/strong> file, and <strong>ajaxifyLinks<\/strong> is a function within that file.<\/p>\n<pre>Drupal.behaviors.custom_js.ajaxifyLinks();<\/pre>\n<p>Call this after new content is loaded like in the below example link will be rendered after 2s, and drupal behavior will be called after that.<\/p>\n<pre>import React, { useState, useEffect } from \"react\";\r\n\r\nconst App = () =&gt; {\r\n  const [timer, setTimer] = useState(false);\r\n\r\n  useEffect(() =&gt; {\r\n    setTimeout(() =&gt; {\r\n      setTimer(true);\r\n    }, 2000);\r\n  }, [])\r\n\r\n  useEffect(() =&gt; {\r\n    Drupal.behaviors.custom_js.ajaxifyLinks();\r\n  }, [timer]);\r\n\r\n  return (\r\n    &lt;&gt;\r\n      {timer &amp;&amp; &lt;a\r\n        href=\"\/admin\/content\"\r\n        className=\"use-ajax\"\r\n        data-dialog-type=\"modal\"\r\n        data-dialog-options='{\"width\":810,\"dialogClass\": \"modal-react\"}'\r\n      &gt;Dialog link&lt;\/a&gt;}\r\n    &lt;\/&gt;\r\n  )\r\n}\r\nexport default App;<\/pre>\n<p>Read More: <a href=\"https:\/\/www.tothenew.com\/blog\/loosely-coupled-pass-data-to-react-app-via-drupalsettings\/\">Loosely Coupled: Pass data to React app via drupalSettings<\/a><\/p>\n<p><strong>Click on the link now, and it will open the dialog.<\/strong><\/p>\n<h3>Optional: Passing parameters<\/h3>\n<p>Parameters can also be passed <strong>from react to drupal behaviors<\/strong>, like for example if we need to pass parent class from react, we can do so:<\/p>\n<pre>Drupal.behaviors.custom_js.ajaxifyLinks('.parent-class');<\/pre>\n<p>And can access it within drupal behaviors like so:<\/p>\n<pre>(function ($, Drupal, drupalSettings) {\r\n  Drupal.behaviors.custom_js = {\r\n    ajaxifyLinks: function (parentClass) {\r\n      console.log(parentClass);\r\n    },\r\n    attach: function (context, settings) {\r\n      \/\/Some JS Code\r\n    }\r\n  }\r\n})(jQuery, Drupal, drupalSettings);<\/pre>\n<p><strong>Note:<\/strong> If any changes are not reflected on page refresh, try clearing the browser or Drupal cache or <strong>unchecking \u201cAggregate JavaScript files\u201d<\/strong> from <strong>\/admin\/config\/development\/performance<\/strong>.<\/p>\n<p>More on <a href=\"https:\/\/www.drupal.org\/docs\/drupal-apis\/ajax-api\/ajax-dialog-boxes\" target=\"_blank\" rel=\"noopener\">Ajax Dialog boxes<\/a>.<\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you&#8217;ll feed them. In order to open some link\/node\/page in a modal window, you can add the [&hellip;]<\/p>\n","protected":false},"author":1124,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":33,"footnotes":""},"categories":[3602,3038],"tags":[5071,4862,5072,5067,4064,5073],"class_list":["post-56311","post","type-post","status-publish","format-standard","hentry","category-drupal","category-react-js","tag-ajax-dialog-boxes","tag-drupal","tag-drupal-behavior","tag-loosely-coupled","tag-react","tag-use-ajax"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you&#039;ll feed them. In order to open some link\/node\/page in a modal window, you can add the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Deepali Bansal\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you&#039;ll feed them. In order to open some link\/node\/page in a modal window, you can add the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you&#039;ll feed them. In order to open some link\/node\/page in a modal window, you can add the\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#article\",\"name\":\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog\",\"headline\":\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/deepali-agarwal\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2023-01-03T16:46:06+05:30\",\"dateModified\":\"2023-01-11T17:03:36+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#webpage\"},\"articleSection\":\"Drupal, React.js, Ajax Dialog Boxes, Drupal, Drupal Behavior, Loosely Coupled, react, use-ajax\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/react-js\\\/#listItem\",\"name\":\"React.js\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/react-js\\\/#listItem\",\"position\":2,\"name\":\"React.js\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/react-js\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#listItem\",\"name\":\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#listItem\",\"position\":3,\"name\":\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/react-js\\\/#listItem\",\"name\":\"React.js\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/deepali-agarwal\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/deepali-agarwal\\\/\",\"name\":\"Deepali Bansal\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/dc1f0330-31ca-488c-96b3-1f464aedabd9_1648-Deepali-Bansal-PROFILEPICTURE.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Deepali Bansal\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/\",\"name\":\"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog\",\"description\":\"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you'll feed them. In order to open some link\\\/node\\\/page in a modal window, you can add the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/deepali-agarwal\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/deepali-agarwal\\\/#author\"},\"datePublished\":\"2023-01-03T16:46:06+05:30\",\"dateModified\":\"2023-01-11T17:03:36+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog","description":"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you'll feed them. In order to open some link\/node\/page in a modal window, you can add the","canonical_url":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#article","name":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog","headline":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/deepali-agarwal\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"datePublished":"2023-01-03T16:46:06+05:30","dateModified":"2023-01-11T17:03:36+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#webpage"},"articleSection":"Drupal, React.js, Ajax Dialog Boxes, Drupal, Drupal Behavior, Loosely Coupled, react, use-ajax"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/react-js\/#listItem","name":"React.js"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/react-js\/#listItem","position":2,"name":"React.js","item":"https:\/\/www.tothenew.com\/blog\/category\/react-js\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#listItem","name":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#listItem","position":3,"name":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/react-js\/#listItem","name":"React.js"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/deepali-agarwal\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/deepali-agarwal\/","name":"Deepali Bansal","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/dc1f0330-31ca-488c-96b3-1f464aedabd9_1648-Deepali-Bansal-PROFILEPICTURE.jpeg","width":96,"height":96,"caption":"Deepali Bansal"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/","name":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog","description":"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you'll feed them. In order to open some link\/node\/page in a modal window, you can add the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/deepali-agarwal\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/deepali-agarwal\/#author"},"datePublished":"2023-01-03T16:46:06+05:30","dateModified":"2023-01-11T17:03:36+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog","og:description":"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you'll feed them. In order to open some link\/node\/page in a modal window, you can add the","og:url":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour | TO THE NEW Blog","twitter:description":"Dialogs are a quick and easy way to display additional information without reloading the entire page. Dialog boxes can display just some static text, any node or form of your page, a views page, or any custom markup you'll feed them. In order to open some link\/node\/page in a modal window, you can add the","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"56311","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65e064e482749","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2023-01-05 04:28:47","updated":"2024-02-29 11:05:08","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/react-js\/\" title=\"React.js\">React.js<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tLoosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"React.js","link":"https:\/\/www.tothenew.com\/blog\/category\/react-js\/"},{"label":"Loosely Coupled: Open Drupal Ajax dialog boxes from React via Drupal Behaviour","link":"https:\/\/www.tothenew.com\/blog\/loosely-coupled-open-drupal-ajax-dialog-boxes-from-react-via-drupal-behaviour\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56311","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1124"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=56311"}],"version-history":[{"count":2,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56311\/revisions"}],"predecessor-version":[{"id":56391,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56311\/revisions\/56391"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=56311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=56311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=56311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}