Hello,
I use latest dev, today i add a new field to a user after saving the settings my drupal install comes up with a warning from microdata modul.

Notice: Undefined index: microdata in microdata_form_field_ui_field_edit_form_submit() (Zeile 242 von ./sites/all/modules/microdata/includes/microdata.form_alter.inc).
Warning: Invalid argument supplied for foreach() in microdata_form_field_ui_field_edit_form_submit() (Zeile 242 von ./sites/all/modules/microdata/includes/microdata.form_alter.inc).

Comments

Anonymous’s picture

Status: Active » Closed (cannot reproduce)

I tried both adding a field to the user programmatically and enabling profile and adding a field to the profile. I could not reproduce this error.

harbhub’s picture

I have this same error:
Notice: Undefined index: microdata in microdata_form_field_ui_field_edit_form_submit() (line 242 of C:\xampp\htdocs\harb1\sites\all\modules\microdata\includes\microdata.form_alter.inc).
Warning: Invalid argument supplied for foreach() in microdata_form_field_ui_field_edit_form_submit() (line 242 of C:\xampp\htdocs\harb1\sites\all\modules\microdata\includes\microdata.form_alter.inc).

Line 242 of C:\xampp\htdocs\harb1\sites\all\modules\microdata\includes\microdata.form_alter.inc looks like this:
foreach ($values['microdata']['fields'] as $field_name => $field_values) {

The entire function starts on line 233 and ends on line 266. This entire function reads as follows:
/**
* Submit callback; saves field mapping in both UIs.
*/
function microdata_form_field_ui_field_edit_form_submit($form, &$form_state) {
$entity_type = isset($form_state['#entity_type']) ? $form_state['#entity_type'] : $form['instance']['entity_type']['#value'];
$bundle = isset($form_state['#bundle_type']) ? $form_state['#bundle_type'] : $form['instance']['bundle']['#value'];
$values = $form_state['values'];

$mapping = _microdata_load_mapping($entity_type, $bundle);
foreach ($values['microdata']['fields'] as $field_name => $field_values) {
$subfields = _microdata_get_field_properties($entity_type, $bundle, $field_name);
// If the field itself is microdata enabled, add the mapping for the field.
if (isset($field_values['field'])) {
$mapping[$field_name] = array(
'#itemprop' => drupal_explode_tags($field_values['field']['itemprop']),
);

// If the field should be handled as an item, add the is_item flag to the
// field's mapping and save the itemtype.
// @todo Consider adding the itemid.
if (!empty($field_values['field']['is_item'])) {
$mapping[$field_name]['#is_item'] = TRUE;

if (isset($field_values['field']['item_fieldset']['itemtype'])) {
$mapping[$field_name]['#itemtype'] = drupal_explode_tags($field_values['field']['item_fieldset']['itemtype']);
}
else {
$mapping[$field_name]['#itemtype'] = array();
}
}
else {
$mapping[$field_name]['#is_item'] = FALSE;
}
}

Any suggestions on how to fix this?

jimi’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2

I have the same problem after enabling the modules Profil2 and Addressfield.

when I change the address field of my profile :
Notice : Undefined index: real path dans microdata_form_field_ui_field_edit_form_alter() (line 99 in */modules/microdata/includes/microdata.form_alter.inc).

line 99 -> $edit_path = $entity_info['bundles'][$bundle]['admin']['real path'];

Anonymous’s picture

Status: Closed (cannot reproduce) » Active

I was actually able to reproduce this with Token in contrib, so moving this to active.

I believe this will happen with form elements which have been inserted into the render array for non-field things or fields that don't have support.

svg1405’s picture

Hello!
I have the problem after changing the text processing from the plain text to the filtered text. There is widget Textarea in the custom content type.

Notice: Undefined index: subfields in microdata_form_field_ui_field_edit_form_submit() (line 271 of C:\Sites\home\drupal7\sites\all\modules\microdata\includes\microdata.form_alter.inc).

line 271: '#itemprop' => drupal_explode_tags($field_values['subfields'][$subfield_name]['itemprop']),

Anonymous’s picture

svg1405, can you try clearing your caches and see if that resolves the issue?

burko’s picture

Tried clearing the caches, this has not fixed the issue.

Both 'microdata' and 'fields' are undefined within the function. I am not sure what they need to be defined as to resolve the error.

I am still very new to programming.
help would be appreciated.

Anonymous’s picture

Can you try downloading the dev version of the module?

Anonymous’s picture

StatusFileSize
new74.39 KB

Hello chaps,

I'm getting this error on D7's default User content-type. No idea how I managed it, but the error is thus:

Notice: Undefined index: real path in microdata_form_field_ui_field_edit_form_alter() (line 99 of /home/thetenor/public_html/sites/all/modules/microdata/includes/microdata.form_alter.inc).

On the page:
/?q=admin/config/people/accounts/fields/field_user_description&destinations[0]=admin/config/people/accounts/fields

mattew’s picture

Priority: Normal » Major

I propose a patch.

mattew’s picture

Status: Active » Needs review
StatusFileSize
new3.98 KB

This is a very simple fix, avoiding error message, author should make a review.
It is not obvious reading the patch, because indentation change, but I just add a test before the foreach loop :

<?php
if (isset($values['microdata'])){
  foreach ($values['microdata']['fields'] as $field_name => $field_values) {
  ...
  }
}
?>
mihai7221’s picture

I tested with 7.x-1.0-beta2 and with 7.x-dev and the latest patch doesn't work. (I cleared my cached)

csheriff’s picture

I was having the same problem...that fixed it! Thanks!

Volx’s picture

I ran across the same problem, patch #11 fixed it for me too. Thanks.

urkon’s picture

Patching failed but manual fixing based on #11 patch was success.
Thanx.

P.S.:
After comparing #11 with my patch the main diference was in starting line:
@@ -240,47 +240,50 @@ ... ----> @@ -239,47 +239,50 @@ ...
and my git root was not on the module but on drupal project.

urkon’s picture

Now I have similar issue in other line. This happens after #11 fix.

When I add new field of type 'term reference' in 'product variation types' in commerce module. I think it is not commerce related.

Notice: Undefined index: real path in microdata_form_field_ui_field_edit_form_alter() (line 99 of ..../sites/all/modules/microdata/includes/microdata.form_alter.inc).

My guess is that the way of #11 fix is needed elsewhere too.

I am a noob in php but will try to fix this since I have a known pattern.

urkon’s picture

Sorry.

It seems this is other issue (https://drupal.org/node/1218800) in drupal commerce module.

urkon’s picture

Hi.
Here is my solution to #16 issue variation. As #17 says this may not be issue of this module, but it can represent here if other modules are not complete.

This patch helps me to have full functionality. This is more workaround than fix.

Since I do not have experience in this community please check if solution matches your standards.