ParentEntity.php in CMS Content Sync 8
File
modules/cms_content_sync_views/src/Plugin/views/field/ParentEntity.php
View source
<?php
namespace Drupal\cms_content_sync_views\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Markup;
use Drupal\views\Plugin\views\field\FieldPluginBase;
use Drupal\views\ResultRow;
class ParentEntity extends FieldPluginBase {
public function query() {
}
protected function defineOptions() {
$options = parent::defineOptions();
return $options;
}
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
}
public function render(ResultRow $values) {
$result = [];
$entity = $values->_entity;
$source = $entity
->getEntity();
if ($source) {
switch ($source
->getEntityTypeId()) {
case 'field_collection_item':
case 'menu_link_content':
case 'brick':
case 'file':
case 'paragraph':
case 'media':
case 'taxonomy_term':
break;
}
}
if (empty($result)) {
return '-';
}
$html = '<ul>';
foreach ($result as $markup) {
$html .= $markup
->render();
}
$html .= '</ul>';
return Markup::create($html);
}
}