add check for proper class hiearchy in table syntax

Plugins extend this class, but may not inherit from Aggregation, yet.
A proper error should be shown.
This commit is contained in:
Andreas Gohr
2023-08-09 09:31:19 +02:00
parent 76021e6613
commit 039b05b8ed

View File

@ -115,8 +115,12 @@ class syntax_plugin_struct_table extends DokuWiki_Syntax_Plugin
$search->setOffset(0);
}
/** @var Aggregation $table */
$table = new $this->tableclass($mainId, $format, $renderer, $search);
if (!is_a($table, Aggregation::class)) {
// this may happen with plugins that extend struct
throw new StructException('Aggregation class does not inherit Aggregation: ' . $this->tableclass);
}
$table->startScope();
$table->render(true);
$table->finishScope();