Function __global->render_attachment
Definitions
sources/attachments.php
- Get Tempcode for a Comcode rich-media attachment.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: object
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $tag | ID_TEXT | No | No | required parameter | attachment attachment_safe | N/A | The attachment tag |
| $attributes | array | No | No | required parameter | N/A | N/A | A map of the attributes (name=>val) for the tag |
| $attachment_row | array | No | No | required parameter | N/A | N/A | A map of the attachment properties (name=>val) for the attachment |
| $pass_id | string | No | No | required parameter | N/A | N/A | A special identifier to mark where the resultant Tempcode is going to end up (e.g. the ID of a post) |
| $source_member | MEMBER | No | No | required parameter | N/A | N/A | The member who is responsible for this Comcode |
| $as_admin | boolean | No | No | required parameter | N/A | N/A | Whether to check as arbitrary admin |
| $db | object | No | No | required parameter | N/A | N/A | The database connector to use |
| $highlight_bits | array | No | No | [] | N/A | N/A | A list of words to highlight |
| $on_behalf_of_member | ?MEMBER | No | No | Null | N/A | N/A | The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (null: member evaluating) |
| $semiparse_mode | boolean | No | No | False | N/A | N/A | Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block). |
Returns
- The Tempcode for the attachment
- Type: Tempcode
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get Tempcode for a Comcode rich-media attachment.
*
* @param ID_TEXT $tag The attachment tag
* @set attachment attachment_safe
* @param array $attributes A map of the attributes (name=>val) for the tag
* @param array $attachment_row A map of the attachment properties (name=>val) for the attachment
* @param string $pass_id A special identifier to mark where the resultant Tempcode is going to end up (e.g. the ID of a post)
* @param MEMBER $source_member The member who is responsible for this Comcode
* @param boolean $as_admin Whether to check as arbitrary admin
* @param object $db The database connector to use
* @param array $highlight_bits A list of words to highlight
* @param ?MEMBER $on_behalf_of_member The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (null: member evaluating)
* @param boolean $semiparse_mode Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block).
* @return Tempcode The Tempcode for the attachment
*/
function render_attachment(string $tag, array $attributes, array $attachment_row, string $pass_id, int $source_member, bool $as_admin, object $db, array $highlight_bits = [], ?int $on_behalf_of_member = null, bool $semiparse_mode = false) : object
* Get Tempcode for a Comcode rich-media attachment.
*
* @param ID_TEXT $tag The attachment tag
* @set attachment attachment_safe
* @param array $attributes A map of the attributes (name=>val) for the tag
* @param array $attachment_row A map of the attachment properties (name=>val) for the attachment
* @param string $pass_id A special identifier to mark where the resultant Tempcode is going to end up (e.g. the ID of a post)
* @param MEMBER $source_member The member who is responsible for this Comcode
* @param boolean $as_admin Whether to check as arbitrary admin
* @param object $db The database connector to use
* @param array $highlight_bits A list of words to highlight
* @param ?MEMBER $on_behalf_of_member The member we are running on behalf of, with respect to how attachments are handled; we may use this members attachments that are already within this post, and our new attachments will be handed to this member (null: member evaluating)
* @param boolean $semiparse_mode Whether to parse so as to create something that would fit inside a semihtml tag. It means we generate HTML, with Comcode written into it where the tag could never be reverse-converted (e.g. a block).
* @return Tempcode The Tempcode for the attachment
*/
function render_attachment(string $tag, array $attributes, array $attachment_row, string $pass_id, int $source_member, bool $as_admin, object $db, array $highlight_bits = [], ?int $on_behalf_of_member = null, bool $semiparse_mode = false) : object

