Like.php in Open Social 10.3.x
Same filename and directory in other branches
- 8.9 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.2 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.3 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.4 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.5 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.6 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.7 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 8.8 modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 10.0.x modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 10.1.x modules/custom/social_demo/src/Plugin/DemoContent/Like.php
- 10.2.x modules/custom/social_demo/src/Plugin/DemoContent/Like.php
Namespace
Drupal\social_demo\Plugin\DemoContentFile
modules/custom/social_demo/src/Plugin/DemoContent/Like.phpView source
<?php
namespace Drupal\social_demo\Plugin\DemoContent;
use Drupal\social_demo\DemoEntity;
/**
* Like Plugin for demo content.
*
* @DemoContent(
* id = "like",
* label = @Translation("Like"),
* source = "content/entity/like.yml",
* entity_type = "vote"
* )
*/
class Like extends DemoEntity {
/**
* {@inheritdoc}
*/
public function getEntry(array $item) {
$entry = parent::getEntry($item);
return $entry + [
'type' => $item['type'],
'entity_type' => $item['entity_type'],
'entity_id' => $this
->loadByUuid($item['entity_type'], $item['entity_id'])
->id(),
'value' => $item['value'],
'value_type' => $item['value_type'],
'user_id' => $this
->loadByUuid('user', $item['uid'])
->id(),
'timestamp' => \Drupal::time()
->getRequestTime(),
'vote_source' => $item['vote_source'],
];
}
}