Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
plugins
CiviCRM Gutenberg Blocks
Commits
60f63019
Commit
60f63019
authored
Feb 13, 2020
by
Andrei Mondoc
Browse files
catch render exception and show 'Could not render preview' message
parent
3a6da03f
Changes
3
Hide whitespace changes
Inline
Side-by-side
civicrm-gutenberg-blocks.php
View file @
60f63019
...
...
@@ -272,8 +272,11 @@ class CiviCRM_Gutenberg_Blocks {
$_REQUEST
[
'gid'
]
=
$atts
[
'gid'
];
ob_start
();
(
new
CRM_Profile_Page_Router
)
->
run
(
$args
);
try
{
(
new
CRM_Profile_Page_Router
)
->
run
(
$args
);
}
catch
(
Exception
$e
)
{
// silence
}
return
ob_get_clean
();
...
...
@@ -296,10 +299,14 @@ class CiviCRM_Gutenberg_Blocks {
ob_start
();
(
new
CRM_Contribute_Controller_Contribution
(
'CiviContribute'
,
CRM_Core_Action
::
ADD
)
)
->
run
();
try
{
(
new
CRM_Contribute_Controller_Contribution
(
'CiviContribute'
,
CRM_Core_Action
::
ADD
)
)
->
run
();
}
catch
(
Exception
$e
)
{
// silence
}
return
ob_get_clean
();
...
...
@@ -323,10 +330,14 @@ class CiviCRM_Gutenberg_Blocks {
ob_start
();
if
(
$atts
[
'action'
]
==
'register'
)
{
(
new
CRM_Event_Controller_Registration
()
)
->
run
();
}
else
{
(
new
CRM_Event_Page_EventInfo
)
->
run
();
try
{
if
(
$atts
[
'action'
]
==
'register'
)
{
(
new
CRM_Event_Controller_Registration
()
)
->
run
();
}
else
{
(
new
CRM_Event_Page_EventInfo
)
->
run
();
}
}
catch
(
Exception
$e
)
{
// silence
}
return
ob_get_clean
();
...
...
@@ -347,7 +358,11 @@ class CiviCRM_Gutenberg_Blocks {
ob_start
();
(
new
CRM_Contact_Page_View_UserDashBoard
()
)
->
run
();
try
{
(
new
CRM_Contact_Page_View_UserDashBoard
()
)
->
run
();
}
catch
(
Exception
$e
)
{
// silence
}
return
ob_get_clean
();
...
...
@@ -569,4 +584,3 @@ function civicrm_gutenberg_blocks() {
add_action
(
'plugins_loaded'
,
'civicrm_gutenberg_blocks'
);
src/assets/blocks/civicrm-content/CiviCRMContentBlock.js
View file @
60f63019
...
...
@@ -11,6 +11,7 @@ import ProfileModeControl from './components/ProfileModeControl'
import
ModeControl
from
'
./components/ModeControl
'
import
ActionControl
from
'
./components/ActionControl
'
import
ExtraAttributesListControl
from
'
./components/ExtraAttributesListControl
'
import
NoPreview
from
'
./components/NoPreview
'
const
CiviCRMContentBlock
=
({
attributes
,
setAttributes
})
=>
{
const
{
component
,
gid
,
id
,
mode
,
action
,
hijack
,
extra_attributes
}
=
attributes
...
...
@@ -50,10 +51,11 @@ const CiviCRMContentBlock = ({ attributes, setAttributes }) => {
<
HijackControl
{...{
hijack
,
setAttributes
}}
/
>
<
ExtraAttributesListControl
{...{
extra_attributes
,
setAttributes
}}
/
>
<
/InspectorControls
>
<
p
>
{
__
(
'
CiviCRM content block
'
,
'
civicrm
'
)}
<
/p
>
<
ServerSideRender
block
=
'
civicrm/civicrm-content-block
'
attributes
=
{
attributes
}
ErrorResponsePlaceholder
=
{
NoPreview
}
EmptyResponsePlaceholder
=
{
NoPreview
}
/
>
<
/
>
)
...
...
src/assets/blocks/civicrm-content/components/NoPreview.js
0 → 100644
View file @
60f63019
import
{
__
}
from
'
@wordpress/i18n
'
const
NoPreview
=
()
=>
<
p
>
{
__
(
'
Could not render preview.
'
,
'
civicrm
'
)}
<
/p
>
export
default
NoPreview
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment