realbig / rbm-field-helpers

0 stars 1 forks source link

Undefined l10n indices for Repeater #45

Closed d4mation closed 6 years ago

d4mation commented 6 years ago

Notice: Undefined index: collapsable_title in /srv/www/greaterjacksonhabitat/public_html/wp-content/themes/theme2018/library/rbm-field-helpers/core/class-rbm-fh-fields.php on line 594

Notice: Undefined index: confirm_delete_text in /srv/www/greaterjacksonhabitat/public_html/wp-content/themes/theme2018/library/rbm-field-helpers/core/class-rbm-fh-fields.php on line 595

Notice: Undefined index: delete_item_text in /srv/www/greaterjacksonhabitat/public_html/wp-content/themes/theme2018/library/rbm-field-helpers/core/class-rbm-fh-fields.php on line 596

Notice: Undefined index: add_item_text in /srv/www/greaterjacksonhabitat/public_html/wp-content/themes/theme2018/library/rbm-field-helpers/core/class-rbm-fh-fields.php on line 597

Called like this (Reference Wiki for what this function does, as it was copied from there):

greater_jackson_habitat_do_field_repeater( array(
        'name' => 'volunteer_faqs',
        'fields' => array(
            'label' => array(
                'type' => 'text',
                'args' => array(
                    'label' => __( 'Label', 'greater-jackson-habitat-theme' ),
                ),
            ),
            'content' => array(
                'type' => 'textarea',
                'args' => array(
                    'label' => __( 'Content', 'greater-jackson-habitat-theme' ),
                    'wysiwyg' => true,
                ),
            ),
        ),
    ) );
d4mation commented 6 years ago

Took a look at the CDATA for this (different project, same bug) and the default localization is there, but it looks like since I didn't define it for the specific Field explicitly it is using null values.

{
  "nonce": "68020b9635",
  "wp_version": "5.0-alpha-42611",
  "instance_id": "psp_gantt",
  "l10n": {
    "field_table": {
      "delete_row": "Delete Row",
      "delete_column": "Delete Column"
    },
    "field_select": {
      "no_options": "No select options.",
      "error_loading": "The results could not be loaded",
      "input_too_long": "Please delete %d character(s)",
      "input_too_short": "Please enter %d or more characters",
      "loading_more": "Loading more results...",
      "maximum_selected": "You can only select %d item(s)",
      "no_results": "No results found",
      "searching": "Searching..."
    },
    "field_repeater": {
      "collapsable_title": "New Row",
      "confirm_delete": "Are you sure you want to delete this element?",
      "delete_item": "Delete",
      "add_item": "Add"
    },
    "field_media": {
      "button_text": "Upload / Choose Media",
      "button_remove_text": "Remove Media",
      "window_title": "Choose Media"
    },
    "field_checkbox": {
      "no_options_text": "No options available."
    }
  },
  "psp_gantt": {
    "repeater": {
      "psp_settings[psp_gantt_task_labels]": {
        "empty": false,
        "collapsable": false,
        "sortable": false,
        "isFirstItemUndeletable": false,
        "l10n": {
          "collapsable_title": null,
          "confirm_delete_text": null,
          "delete_item_text": null,
          "add_item_text": null
        },
        "id": "psp_settings[psp_gantt_task_labels]",
        "default": ""
      },
      "psp_settings[psp_gantt_task_colors]": {
        "empty": true,
        "collapsable": false,
        "sortable": false,
        "isFirstItemUndeletable": false,
        "l10n": {
          "collapsable_title": null,
          "confirm_delete_text": null,
          "delete_item_text": null,
          "add_item_text": null
        },
        "id": "psp_settings[psp_gantt_task_colors]",
        "default": ""
      }
    },
    "repeaterFields": {
      "psp_settings[psp_gantt_task_colors]": {
        "color": {
          "id": "psp_settings[psp_gantt_task_colors]_color",
          "default": "#fff"
        }
      }
    }
  }
}