Skip to content
Snippets Groups Projects
Commit c29df689 authored by jens.preussner's avatar jens.preussner :ghost:
Browse files

Updated ANY signature of add_component

parent e5678577
No related branches found
No related tags found
1 merge request!18Generic htm lwidget
Pipeline #129962 failed
......@@ -21,9 +21,9 @@ Imports:
rmarkdown,
stringr,
glue,
ymlthis,
switchr
ymlthis
Suggests:
switchr,
highcharter,
plotly,
crosstalk,
......
......@@ -64,14 +64,20 @@ setMethod("add_component",
setMethod("add_component",
signature = signature(dashboard = "i2dashboard", component = "ANY"),
definition = function(dashboard, component, page = "default", title = NULL, ...) {
if(!inherits(component, "htmlwidget")) {
warning("The object has to inherit from the class 'htmlwidget'.")
return(dashboard)
}
package <- packageSlot(component)
if(is.null(package)) {
warning("The package name of this HTML widget could not be determined. The component was not added to the dashboard.")
return(dashboard)
# HTMLWIDGETS
if(inherits(component, "htmlwidget")) {
package <- packageSlot(component)
if(is.null(package)) {
warning("No component added, since the package name of the HTML widget could not be determined.")
return(dashboard)
}
return(add_vis_object(dashboard, component, package, page, title, ...))
}
add_vis_object(dashboard, component, package, page, title, ...)
# OTHER
warning("The component did not inherit from any of the currently supported classes ('htmlwidget').")
return(dashboard)
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment