original_string: private function getPrepareFieldLayout(array $fieldLayoutDef): array
      {
          $layoutFields = [];
          $requiredFields = [];
  
          foreach ($fieldLayoutDef as $fieldHandle => $required) {
              $field = Craft::$app->fields->getFieldByHandle($fieldHandle);
              if ($field instanceof Field) {
                  $layoutFields[] = $field->id;
  
                  if ($required) {
                      $requiredFields[] = $field->id;
                  }
              }
          }
  
          return [
            'fields' => $layoutFields,
            'required' => $requiredFields,
          ];
      }
code: private function getPrepareFieldLayout(array $fieldLayoutDef): array
      {
          $layoutFields = [];
          $requiredFields = [];
  
          foreach ($fieldLayoutDef as $fieldHandle => $required) {
              $field = Craft::$app->fields->getFieldByHandle($fieldHandle);
              if ($field instanceof Field) {
                  $layoutFields[] = $field->id;
  
                  if ($required) {
                      $requiredFields[] = $field->id;
                  }
              }
          }
  
          return [
            'fields' => $layoutFields,
            'required' => $requiredFields,
          ];
      }
code_tokens: private function getPrepareFieldLayout ( array $ fieldLayoutDef ) : array { $ layoutFields = [ ] ; $ requiredFields = [ ] ; foreach ( $ fieldLayoutDef as $ fieldHandle => $ required ) { $ field = Craft :: $ app -> fields -> getFieldByHandle ( $ fieldHandle ) ; if ( $ field instanceof Field ) { $ layoutFields [ ] = $ field -> id ; if ( $ required ) { $ requiredFields [ ] = $ field -> id ; } } } return [ 'fields' => $ layoutFields , 'required' => $ requiredFields , ] ; }
docstring: Get a prepared fieldLayout for the craft assembleLayout function.
  
  @param array $fieldLayoutDef
  
  @return array
docstring_tokens: Get a prepared fieldLayout for the craft assembleLayout function .