Skip to content

Commit

Permalink
Support rendering regardless of entity type
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeedJack committed Mar 9, 2022
1 parent 2049497 commit 4ecfdd7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
10 changes: 1 addition & 9 deletions BbCode/TagRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,7 @@ private static function getEntityId($entity)
//\XF::logError('Can not get post/resource id: $entity is not defined.');
return 0;
}
if ($entity instanceof \XF\Entity\Post)
return $entity->post_id;
if ($entity instanceof \XF\Entity\ConversationMessage)
return $entity->message_id;
if (class_exists('\XFRM\Entity\ResourceUpdate')
&& $entity instanceof \XFRM\Entity\ResourceUpdate)
return $entity->resource_id;
\XF::logError('Can not get post/resource id: unsupported entity type.');
return 0;
return $entity->getEntityId();
}

private static function getNumByDepth($depth, $override = -1)
Expand Down
4 changes: 2 additions & 2 deletions addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"legacy_addon_id": "",
"title": "[Inforge] PostTOC",
"description": "Add BBCode to support the creation of a table of contents in posts.",
"version_id": 1000070,
"version_string": "1.0.0",
"version_id": 1000170,
"version_string": "1.0.1",
"dev": "Inforge",
"dev_url": "https://www.inforge.net",
"faq_url": "https://github.com/InforgeNet/PostTOC/wiki/Frequently-Asked-Questions",
Expand Down
5 changes: 5 additions & 0 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@
],
"minify": [
"js/inforge/posttoc/toc-renderer.js"
],
"exec": [
"mv _build/upload/src/addons/Inforge/PostTOC/README.md _build/",
"mv _build/upload/src/addons/Inforge/PostTOC/CONTRIBUTING.md _build/",
"mv _build/upload/src/addons/Inforge/PostTOC/LICENSE _build/"
]
}

0 comments on commit 4ecfdd7

Please sign in to comment.