Пример #1
0
 /**
  * Disable fields that are not allowed to be modified since integration has at least one sync completed
  *
  * @param FormInterface $form
  * @param Integration       $integration
  */
 protected function muteFields(FormInterface $form, Integration $integration = null)
 {
     if (!($integration && $integration->getId())) {
         // do nothing if integration is new
         return;
     }
     if ($integration->getEditMode() !== Integration::EDIT_MODE_ALLOW) {
         // disable type field
         FormUtils::replaceField($form, 'type', ['disabled' => true]);
     }
     if (Integration::EDIT_MODE_DISALLOW === $integration->getEditMode()) {
         FormUtils::replaceField($form, 'connectors', ['disabled' => true, 'attr' => ['class' => 'hide']]);
     }
 }