private function getBundleFields($entityTypeId, $bundle)
    {
        $fields = [];
        if (!empty($entityTypeId) && !empty($bundle)) {
            $fields = array_filter(
                $this->entityFieldManager->getFieldDefinitions($entityTypeId, $bundle),
                function ($fieldDefinition) {
                    return $fieldDefinition instanceof FieldConfigInterface;
                }
            );
        }

        return $fields;
    }
private function getBundleFields($entityTypeId, $bundle)
    {
        $fields = [];
        if (!empty($entityTypeId) && !empty($bundle)) {
            $fields = array_filter(
                $this->entityFieldManager->getFieldDefinitions($entityTypeId, $bundle),
                function ($fieldDefinition) {
                    return $fieldDefinition instanceof FieldConfigInterface;
                }
            );
        }

        return $fields;
    }
private function getBundleFields ( $ entityTypeId , $ bundle ) { $ fields = [ ] ; if ( ! empty ( $ entityTypeId ) && ! empty ( $ bundle ) ) { $ fields = array_filter ( $ this -> entityFieldManager -> getFieldDefinitions ( $ entityTypeId , $ bundle ) , function ( $ fieldDefinition ) { return $ fieldDefinition instanceof FieldConfigInterface ; } ) ; } return $ fields ; }
Helper function to get the field definitions.

@param  string $entityTypeId
The entity type we want to inspect.
@param  string $bundle
The bundle we want to discover the fields of.
@return array
An array of field storage definitions for the entity type,
keyed by field name.
Helper function to get the field definitions .