ColorboxFieldFormatterEntityreference.php in Colorbox field formatter 8
File
src/Plugin/Field/FieldFormatter/ColorboxFieldFormatterEntityreference.php
View source
<?php
namespace Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
class ColorboxFieldFormatterEntityreference extends ColorboxFieldFormatter {
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$form['link_type']['#access'] = FALSE;
$form['link']['#access'] = FALSE;
return $form;
}
protected function viewValue(FieldItemInterface $item) {
return $item->entity
->label();
}
protected function getUrl(FieldItemInterface $item) : Url {
return $item->entity
->toUrl();
}
}