What I'm trying to do is ->
$fields = [];
$fields = $entity->getFieldDefinitions();
foreach ($fields as $field) {
if ($field->field_type == 'type') {
$test = $field->field_type;
}
}
Unfortunately I couldn't find a neat method to select my fields by type, so I thought unless Drupal won't give me one I write my own. But Drupal restrict me on that also with this -> Fatal error: Cannot access protected property
Fatal error: Cannot access protected property Drupal\field\Entity\FieldConfig::$field_type