You are here

protected function Event::getEntry in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  2. 8.2 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  3. 8.3 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  4. 8.4 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  5. 8.5 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  6. 8.6 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  7. 8.7 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  8. 8.8 modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  9. 10.3.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  10. 10.0.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  11. 10.1.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()
  12. 10.2.x modules/custom/social_demo/src/Plugin/DemoContent/Event.php \Drupal\social_demo\Plugin\DemoContent\Event::getEntry()

Makes an array with data of an entity.

Parameters

array $item: Array with items.

Return value

array Returns an array.

Overrides DemoNode::getEntry

File

modules/custom/social_demo/src/Plugin/DemoContent/Event.php, line 69

Class

Event
Event Plugin for demo content.

Namespace

Drupal\social_demo\Plugin\DemoContent

Code

protected function getEntry(array $item) {
  $entry = parent::getEntry($item);
  $entry['field_event_address'] = $item['field_event_address'];
  $entry['field_event_date'] = $this
    ->createEventDate($item['field_event_date']);
  $entry['field_event_date_end'] = $this
    ->createEventDate($item['field_event_date_end']);
  $entry['field_event_location'] = $item['field_event_location'];
  $entry['field_content_visibility'] = $item['field_content_visibility'];

  // Load image by uuid and set to node.
  if (!empty($item['field_event_image'])) {
    $entry['field_event_image'] = $this
      ->prepareImage($item['field_event_image']);
  }

  // Load attachments to node.
  if (!empty($item['field_files'])) {
    $entry['field_files'] = $this
      ->prepareAttachment($item['field_files']);
  }
  if (\Drupal::moduleHandler()
    ->moduleExists('social_event_type') && !empty($item['field_event_type'])) {
    $entry['field_event_type'] = $this
      ->prepareEventType($item['field_event_type']);
  }

  // Possibility to add event managers (if the module is enabled)
  if (\Drupal::moduleHandler()
    ->moduleExists('social_event_managers') && !empty($item['field_event_managers'])) {
    $entry['field_event_managers'] = $this
      ->prepareEventManagers($item['field_event_managers']);
  }
  return $entry;
}