Skip to content
Snippets Groups Projects

Initial improvements for template creation.

8 unresolved threads

Closes #3492704

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
357 360 }
358 361
359 362 $termStorage = $this->entityTypeManager->getStorage('taxonomy_term');
360 $values = [
361 'langcode' => $language->getId(),
362 ];
363 363 $settings = $field->getSetting('handler_settings');
364 364
365 // @todo This can potentially create lot's of options there.
366 $values = [];
367 if ($field->isTranslatable()) {
368 $values['langcode'] = $language->getId();
  • 376 382 'label' => $term->label(),
    377 383 ];
    378 384
    385 if (!$term->hasField('contentworkflowbynder_option_ids')) {
  • 387 397 $term->save();
    388 398 }
    389 399
    400 if (empty($options)) {
    401 throw new \Exception('No terms found to populate checkbox options.');
  • 402 }
    403
    390 404 $metadata = [
    391 405 'choice_fields' => [
    392 406 'options' => $options,
    393 407 ],
    394 408 ];
    395 409 }
    396
    397 if ($field->getType() === 'entity_reference_revisions') {
    410 elseif ($field->getType() === 'entity_reference_revisions') {
    398 411 $settings = $field->getSetting('handler_settings');
    399 412
    400 413 if (empty($settings['target_bundles'])) {
    401 continue;
    414 continue;
  • 451 'field_type' => $fieldType,
    452 'label' => $fieldLabel,
    453 'component' => array_merge(['uuid' => $this->uuidService->generate()], $componentsFields),
    454 ];
    455 }
    456 else {
    457 $group['fields'][] = [
    458 'uuid' => $fieldUuid,
    459 'field_type' => $fieldType,
    460 'label' => $fieldLabel,
    461 'metadata' => $metadata,
    462 ];
    463 }
    440 464
    441 $fieldId = $field->id();
    465 $fieldId = ($field instanceof BaseFieldDefinition) ? $field->getName() : $field->id();
    • the change to basefield seems quite problematic. I'd expect that will also add all kinds of id fields and what not to this, or does it only cover fields that have a specific type?

      I don't remember why exactly we made that change and what the requirement around it is.

    • Author Developer

      I think it only covers fields that are mapped in ::FIELD_COMBINATIONS or are entity references or entity reference revisions.

      IIRC this only improves the current behavior (maybe prevents notices, not sure).

    • yes, but field map has for example string and entity_reference.

      node.type is an entity reference field. node.uid is. I guess it actually only supports taxonomy term references?

      Paragraphs have parent_id, parent_type, parent_field_name. behavior_settings as string and string_long. none of those should be mapped.

      only looking at configurable fields is pretty crude, but it's a reasonable start. There might be custom entity types that only have base fields and those should be mapped, but without a whole interactive UI process (e.g. preview with checkboxes to enable/disable), we should stick to configurable fields for now. it's possible that I initially said something else.

    • ah, it does filter based on the form display, that's less of a concern. still unsure if that's necessary and what problem we were trying to fix originally.

    • Please register or sign in to reply
  • 31 32 'is_ascii' => FALSE,
    32 33 'case_sensitive' => FALSE,
    33 34 ],
    34 ])->save();
    35 ]);
    36 $field_storage->save();
    37
    38 foreach (Vocabulary::loadMultiple() as $vocabulary) {
  • 180 196 'content_workflow_bynder_entity_mapping' => _content_workflow_bynder_entity_mapping_spec(),
    181 197 ];
    182 198 }
    199
    200 /**
    201 * Add identifier fields to taxonomy terms.
    202 */
    203 function content_workflow_bynder_update_10101() {
  • Primoz Hmeljak added 1 commit

    added 1 commit

    • 513ceaf6 - Template creation improvements: partial review addressing.

    Compare with previous version

  • 5 5 * Install and uninstall script for Content Workflow module.
    6 6 */
    7 7
    8 use Drupal\Core\Database\Database;
    9 8 use Drupal\Core\Field\FieldStorageDefinitionInterface;
    10 9 use Drupal\field\Entity\FieldConfig;
    11 10 use Drupal\field\Entity\FieldStorageConfig;
    12 11 use Drupal\content_workflow_bynder\Entity\Mapping;
    12 use Drupal\taxonomy\Entity\Vocabulary;
    13
    13 14
    14 15 /**
    15 16 * Implements hook_install().
    16 17 */
    17 18 function content_workflow_bynder_install() {
    18 if (\Drupal::entityTypeManager()->hasDefinition('taxonomy_term')) {
    • this removes the existing logic of defining the storage definition. that does need to exist at some point, it could just be a optional config though, that also deals with situations where taxonomy is enabled later. but we still need something.

    • Please register or sign in to reply
    Please register or sign in to reply
    Loading