| Conditions | 1 |
| Paths | 1 |
| Total Lines | 225 |
| Code Lines | 162 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 155 | public function buildForm(FormBuilderInterface $builder): void |
||
| 156 | { |
||
| 157 | $tools = $this->getProcessedToolChain(); |
||
| 158 | |||
| 159 | $builder |
||
| 160 | ->add( |
||
| 161 | 'active_tools_on_create', |
||
| 162 | ChoiceType::class, |
||
| 163 | [ |
||
| 164 | 'choices' => $tools, |
||
| 165 | 'multiple' => true, |
||
| 166 | 'expanded' => true, |
||
| 167 | ] |
||
| 168 | ) |
||
| 169 | ->add('display_coursecode_in_courselist', YesNoType::class) |
||
| 170 | ->add('display_teacher_in_courselist', YesNoType::class) |
||
| 171 | ->add('student_view_enabled', YesNoType::class) |
||
| 172 | ->add('go_to_course_after_login', YesNoType::class) |
||
| 173 | ->add( |
||
| 174 | 'show_navigation_menu', |
||
| 175 | ChoiceType::class, |
||
| 176 | [ |
||
| 177 | 'choices' => [ |
||
| 178 | 'No' => 'false', |
||
| 179 | 'Icons only' => 'icons', |
||
| 180 | 'Text only' => 'text', |
||
| 181 | 'Icons text' => 'iconstext', |
||
| 182 | ], |
||
| 183 | ] |
||
| 184 | ) |
||
| 185 | ->add('enable_tool_introduction', YesNoType::class) |
||
| 186 | ->add( |
||
| 187 | 'breadcrumbs_course_homepage', |
||
| 188 | ChoiceType::class, |
||
| 189 | [ |
||
| 190 | 'choices' => [ |
||
| 191 | 'Course homepage' => 'course_home', |
||
| 192 | 'Course code' => 'course_code', |
||
| 193 | 'Course title' => 'course_title', |
||
| 194 | 'Session name and course title' => 'session_name_and_course_title', |
||
| 195 | ], |
||
| 196 | ] |
||
| 197 | ) |
||
| 198 | ->add('example_material_course_creation', YesNoType::class) |
||
| 199 | ->add('allow_course_theme', YesNoType::class) |
||
| 200 | ->add('allow_users_to_create_courses', YesNoType::class) |
||
| 201 | ->add('show_courses_descriptions_in_catalog', YesNoType::class) |
||
| 202 | ->add('send_email_to_admin_when_create_course', YesNoType::class) |
||
| 203 | ->add('allow_user_course_subscription_by_course_admin', YesNoType::class) |
||
| 204 | ->add('course_validation', YesNoType::class) |
||
| 205 | ->add('course_validation_terms_and_conditions_url', UrlType::class) |
||
| 206 | ->add( |
||
| 207 | 'course_hide_tools', |
||
| 208 | ChoiceType::class, |
||
| 209 | [ |
||
| 210 | 'choices' => $tools, |
||
| 211 | 'multiple' => true, |
||
| 212 | 'expanded' => true, |
||
| 213 | ] |
||
| 214 | ) |
||
| 215 | ->add('scorm_cumulative_session_time', YesNoType::class) |
||
| 216 | ->add( |
||
| 217 | 'courses_default_creation_visibility', |
||
| 218 | ChoiceType::class, |
||
| 219 | [ |
||
| 220 | 'choices' => [ |
||
| 221 | 'Public' => '3', |
||
| 222 | 'Open' => '2', |
||
| 223 | 'Private' => '1', |
||
| 224 | 'Closed' => '0', |
||
| 225 | ], |
||
| 226 | ] |
||
| 227 | ) |
||
| 228 | ->add('allow_public_certificates', YesNoType::class) |
||
| 229 | ->add('allow_lp_return_link', YesNoType::class) |
||
| 230 | ->add( |
||
| 231 | 'course_creation_use_template', |
||
| 232 | EntityType::class, |
||
| 233 | [ |
||
| 234 | 'class' => Course::class, |
||
| 235 | 'placeholder' => 'Choose ...', |
||
| 236 | 'empty_data' => null, |
||
| 237 | 'choice_label' => 'title', |
||
| 238 | 'choice_value' => 'id', |
||
| 239 | 'required' => false, |
||
| 240 | ] |
||
| 241 | ) |
||
| 242 | ->add('hide_scorm_export_link', YesNoType::class) |
||
| 243 | ->add('hide_scorm_copy_link', YesNoType::class) |
||
| 244 | ->add('hide_scorm_pdf_link', YesNoType::class) |
||
| 245 | ->add('course_catalog_published', YesNoType::class) |
||
| 246 | ->add('course_images_in_courses_list', YesNoType::class) |
||
| 247 | ->add('teacher_can_select_course_template', YesNoType::class) |
||
| 248 | ->add('show_toolshortcuts', YesNoType::class) |
||
| 249 | ->add('enable_record_audio', YesNoType::class) |
||
| 250 | ->add('lp_show_reduced_report', YesNoType::class) |
||
| 251 | ->add('course_creation_splash_screen', YesNoType::class) |
||
| 252 | ->add('block_registered_users_access_to_open_course_contents', YesNoType::class) |
||
| 253 | ->add('enable_bootstrap_in_documents_html', YesNoType::class) |
||
| 254 | ->add('view_grid_courses', YesNoType::class) |
||
| 255 | ->add('show_simple_session_info', YesNoType::class) |
||
| 256 | ->add('my_courses_show_courses_in_user_language_only', YesNoType::class) |
||
| 257 | ->add('allow_public_course_with_no_terms_conditions', YesNoType::class) |
||
| 258 | ->add('show_all_sessions_on_my_course_page', YesNoType::class) |
||
| 259 | ->add('disabled_edit_session_coaches_course_editing_course', YesNoType::class) |
||
| 260 | ->add('allow_base_course_category', YesNoType::class) |
||
| 261 | ->add('hide_course_sidebar', YesNoType::class) |
||
| 262 | ->add('allow_course_extra_field_in_catalog', YesNoType::class) |
||
| 263 | ->add('multiple_access_url_show_shared_course_marker', YesNoType::class) |
||
| 264 | ->add( |
||
| 265 | 'course_category_code_to_use_as_model', |
||
| 266 | TextType::class, |
||
| 267 | [ |
||
| 268 | 'label' => 'CourseCategoryCodeToUseAsModelTitle', |
||
| 269 | 'help' => 'CourseCategoryCodeToUseAsModelComment', |
||
| 270 | ] |
||
| 271 | ) |
||
| 272 | ->add('enable_unsubscribe_button_on_my_course_page', YesNoType::class) |
||
| 273 | ->add('course_creation_donate_message_show', YesNoType::class) |
||
| 274 | ->add( |
||
| 275 | 'course_creation_donate_link', |
||
| 276 | TextType::class, |
||
| 277 | [ |
||
| 278 | 'label' => 'CourseCreationDonateLinkTitle', |
||
| 279 | 'help' => 'CourseCreationDonateLinkComment', |
||
| 280 | ] |
||
| 281 | ) |
||
| 282 | ->add( |
||
| 283 | 'courses_list_session_title_link', |
||
| 284 | ChoiceType::class, |
||
| 285 | [ |
||
| 286 | 'choices' => [ |
||
| 287 | 'No link' => '0', |
||
| 288 | 'Default' => '1', |
||
| 289 | 'Link' => '2', |
||
| 290 | 'Session link' => '3', |
||
| 291 | ], |
||
| 292 | ] |
||
| 293 | ) |
||
| 294 | ->add('hide_course_rating', YesNoType::class) |
||
| 295 | ->add( |
||
| 296 | 'course_log_hide_columns', |
||
| 297 | TextareaType::class, |
||
| 298 | [ |
||
| 299 | 'help_html' => true, |
||
| 300 | 'help' => $this->settingArrayHelpValue('course_log_hide_columns'), |
||
| 301 | ] |
||
| 302 | ) |
||
| 303 | ->add( |
||
| 304 | 'course_student_info', |
||
| 305 | TextareaType::class, |
||
| 306 | [ |
||
| 307 | 'help_html' => true, |
||
| 308 | 'help' => $this->settingArrayHelpValue('course_student_info'), |
||
| 309 | ] |
||
| 310 | ) |
||
| 311 | ->add( |
||
| 312 | 'course_catalog_settings', |
||
| 313 | TextareaType::class, |
||
| 314 | [ |
||
| 315 | 'help_html' => true, |
||
| 316 | 'help' => $this->settingArrayHelpValue('course_catalog_settings'), |
||
| 317 | ] |
||
| 318 | ) |
||
| 319 | ->add('resource_sequence_show_dependency_in_course_intro', YesNoType::class) |
||
| 320 | ->add('course_catalog_display_in_home', YesNoType::class) |
||
| 321 | ->add('course_creation_form_set_course_category_mandatory', YesNoType::class) |
||
| 322 | ->add('course_creation_form_hide_course_code', YesNoType::class) |
||
| 323 | ->add('course_about_teacher_name_hide', YesNoType::class) |
||
| 324 | ->add('course_visibility_change_only_admin', YesNoType::class) |
||
| 325 | ->add('catalog_hide_public_link', YesNoType::class) |
||
| 326 | ->add( |
||
| 327 | 'course_log_default_extra_fields', |
||
| 328 | TextareaType::class, |
||
| 329 | [ |
||
| 330 | 'help_html' => true, |
||
| 331 | 'help' => $this->settingArrayHelpValue('course_log_default_extra_fields'), |
||
| 332 | ] |
||
| 333 | ) |
||
| 334 | ->add('show_courses_in_catalogue', YesNoType::class) |
||
| 335 | ->add( |
||
| 336 | 'courses_catalogue_show_only_category', |
||
| 337 | TextareaType::class, |
||
| 338 | [ |
||
| 339 | 'help_html' => true, |
||
| 340 | 'help' => $this->settingArrayHelpValue('courses_catalogue_show_only_category'), |
||
| 341 | ] |
||
| 342 | ) |
||
| 343 | ->add( |
||
| 344 | 'course_creation_by_teacher_extra_fields_to_show', |
||
| 345 | TextareaType::class, |
||
| 346 | [ |
||
| 347 | 'help_html' => true, |
||
| 348 | 'help' => $this->settingArrayHelpValue('course_creation_by_teacher_extra_fields_to_show'), |
||
| 349 | ] |
||
| 350 | ) |
||
| 351 | ->add( |
||
| 352 | 'course_creation_form_set_extra_fields_mandatory', |
||
| 353 | TextareaType::class, |
||
| 354 | [ |
||
| 355 | 'help_html' => true, |
||
| 356 | 'help' => $this->settingArrayHelpValue('course_creation_form_set_extra_fields_mandatory'), |
||
| 357 | ] |
||
| 358 | ) |
||
| 359 | ->add( |
||
| 360 | 'course_configuration_tool_extra_fields_to_show_and_edit', |
||
| 361 | TextareaType::class, |
||
| 362 | [ |
||
| 363 | 'help_html' => true, |
||
| 364 | 'help' => $this->settingArrayHelpValue('course_configuration_tool_extra_fields_to_show_and_edit'), |
||
| 365 | ] |
||
| 366 | ) |
||
| 367 | ->add( |
||
| 368 | 'course_creation_user_course_extra_field_relation_to_prefill', |
||
| 369 | TextareaType::class, |
||
| 370 | [ |
||
| 371 | 'help_html' => true, |
||
| 372 | 'help' => $this->settingArrayHelpValue('course_creation_user_course_extra_field_relation_to_prefill'), |
||
| 373 | ] |
||
| 374 | ) |
||
| 375 | ->add('allow_edit_tool_visibility_in_session', YesNoType::class) |
||
| 376 | ->add('show_course_duration', YesNoType::class) |
||
| 377 | ; |
||
| 378 | |||
| 379 | $this->updateFormFieldsFromSettingsInfo($builder); |
||
| 380 | } |
||
| 455 |