use Fluidbook\Tools\Links\ContentLink;
use Fluidbook\Tools\SVG\SVGTools;
use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
use SimpleXMLElement;
use SplFileInfo;
}
foreach ($linksToAdd as $lta) {
- /** @var $lta Link */
- // Keep this line because some properties of the link (like blend mode) are parsed with this function
- $c = $lta->getHTMLContainer();
- $css[] = $lta->getCSSContainer();
- if (!isset($pages[$lta->page])) {
- $pages[$lta->page] = ['normal' => []];
- $cpages[$lta->page] = ['normal' => []];
- $ctpages[$lta->page] = ['normal' => []];
- }
+ try {
+ /** @var $lta Link */
+ // Keep this line because some properties of the link (like blend mode) are parsed with this function
+ $c = $lta->getHTMLContainer();
+ $css[] = $lta->getCSSContainer();
+ if (!isset($pages[$lta->page])) {
+ $pages[$lta->page] = ['normal' => []];
+ $cpages[$lta->page] = ['normal' => []];
+ $ctpages[$lta->page] = ['normal' => []];
+ }
- $d = $lta->getDepth();
- if ($d < 30) {
- $v = 'ctpages';
- } else if ($d < 50) {
- $v = 'cpages';
- } else {
- $v = 'pages';
- }
+ $d = $lta->getDepth();
+ if ($d < 30) {
+ $v = 'ctpages';
+ } else if ($d < 50) {
+ $v = 'cpages';
+ } else {
+ $v = 'pages';
+ }
- $lta->setInitialOrder($i);
- if (!isset($$v[$lta->page][$lta->blendmode])) {
- $$v[$lta->page][$lta->blendmode] = [];
- }
+ $lta->setInitialOrder($i);
+ if (!isset($$v[$lta->page][$lta->blendmode])) {
+ $$v[$lta->page][$lta->blendmode] = [];
+ }
- array_push($$v[$lta->page][$lta->blendmode], $lta);
- $i++;
+ array_push($$v[$lta->page][$lta->blendmode], $lta);
+ $i++;
+ } catch (\Exception $e) {
+ $this->triggerLinkError($e, $lta);
+ }
}
// Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL
if ($link->page == 'aftersearch') {
return $css;
}
+ /**
+ * @param $e \Exception
+ * @param $link Link
+ * @return void
+ * @throws \Exception
+ */
+ protected function triggerLinkError($e, $link)
+ {
+ Log::error($e);
+
+ $c=explode('\\',get_class($link));
+ $type=array_pop($c);
+ $type=str_replace('Link','',$type);
+
+ throw new \Exception('Error on the '.$type.' link to ' . $link->to . ' on page ' . $link->page . ' with message : ' . $e->getMessage());
+ }
+
protected function _htmlLinkList($list)
{
if (!count($list)) {