Elgg  Version 7.1
Variables
save.php File Reference

Go to the source code of this file.

Variables

 $entity_guid = (int) get_input('entity_guid', 0, false)
 
 $comment_guid = (int) get_input('comment_guid', 0, false)
 
 $comment_text = get_input('generic_comment')
 
if(empty($comment_text)) if($comment_guid) else
 
if(! $entity instanceof \ElggEntity) if(! $entity->canComment()) $comment = new \ElggComment()
 
$comment description = $comment_text
 
if($entity instanceof \ElggComment) $comment container_guid = $entity->guid
 
$comment access_id = $entity->access_id
 
if(! $comment->save()) if($comment->getLevel()===1) $success_message = elgg_echo('generic_comment:posted')
 
 $comment_count = $entity->countComments()
 
 $result
 

Variable Documentation

◆ $comment

if (! $entity instanceof \ElggEntity) if (! $entity->canComment()) $comment = new \ElggComment()

Definition at line 45 of file save.php.

◆ $comment_count

$comment_count = $entity->countComments()

Definition at line 78 of file save.php.

◆ $comment_guid

$comment_guid = (int) get_input('comment_guid', 0, false)

Definition at line 9 of file save.php.

◆ $comment_text

$comment_text = get_input('generic_comment')

Definition at line 10 of file save.php.

◆ $entity_guid

$entity_guid = (int) get_input('entity_guid', 0, false)

Definition at line 8 of file save.php.

◆ $result

$result
Initial value:
= [
'guid' => $comment->guid,
'output' => elgg_view_entity($comment),
'container_guid' => $entity->guid,
'container_comment_count' => $comment_count,
'container_comment_badge_text' => $comment_count ? Values::shortFormatOutput($comment_count, 1) : null,
]
if(! $entity instanceof \ElggEntity) if(! $entity->canComment()) $comment
Definition: save.php:45
$comment_count
Definition: save.php:78
elgg_view_entity(\ElggEntity $entity, array $vars=[])
Returns a string of a rendered entity.
Definition: views.php:513
$entity
Definition: save.php:17

Definition at line 80 of file save.php.

◆ $success_message

if (! $comment->save()) if ( $comment->getLevel()===1) $success_message = elgg_echo('generic_comment:posted')

Definition at line 75 of file save.php.

◆ access_id

$comment access_id = $entity->access_id

Definition at line 58 of file save.php.

◆ container_guid

if ( $entity instanceof \ElggComment) $comment container_guid = $entity->guid

Definition at line 57 of file save.php.

◆ description

$comment description = $comment_text

Definition at line 46 of file save.php.

◆ else

if (empty( $comment_text)) if ( $comment_guid) else
Initial value:
{
$entity_guid
Definition: save.php:8
get_entity(int $guid)
Loads and returns an entity object from a guid.
Definition: entities.php:68

Definition at line 34 of file save.php.