$formData Current form data (unused) * * @return bool True if fields should be shown as static text (read-only) */ public function evaluate(BookingDto $bookingDto, int $participantIndex, array $formData): bool { // This condition only applies to first participant (agency-based read-only) // Non-first participants: return false here, but may still be read-only via PersonalDataMutabilityCondition if (0 !== $participantIndex) { return false; } $participant = $bookingDto->getParticipant($participantIndex); // CREATE mode logic if (BookingDto::MODE_CREATE === $bookingDto->getMode()) { // Anonymous user (no personId) = must fill in data = editable if (null === $participant?->personId) { return false; } // Internal agency = first participant ≠ applicant = editable if ($bookingDto->isInternalAgencyBooking()) { return false; } // Logged-in user with non-internal agency = data prepopulated = read-only return true; } // EDIT mode logic // Internal agency = first participant ≠ applicant = editable (mutability check applies separately) if ($bookingDto->isInternalAgencyBooking()) { return false; } // Non-internal agency = first participant = applicant = always read-only return true; } /** * Returns field names that this condition depends on. * * This condition is based on agency code and personId which are set during initialization * and don't change during form interaction, so no field dependencies. * * @return string[] Empty array - no field dependencies */ public function getDependentFields(): array { return []; } /** * Returns a human-readable description of this condition. * * @return string Description of the first participant read-only logic */ public function getDescription(): string { return 'First participant personal data is read-only for non-internal agency bookings with logged-in users'; } }