// Keep a copy of the field id attribute. $f_atts['id'] = $field['name'] . '-' . $i . '-' . $f['name'] . '-id'; // Update the id attribute of the field. $f['atts'] = $f_atts; // Update ALL attributes of the field. Contains its new id value. // Grab the value if it exists. if (isset($field['value'][$i][$f['name']])) { $f['value'] = $field['value'][$i][$f['name']]; } // Set the name attribute. // Note: this completely change the name attribute. Do not write // any code that would need the default 'name' attribute below. $defaultName = $f['name']; $f['name'] = $field['name'] . '[' . $i . '][' . $f['name'] . ']'; // Render the field. echo Themosis\Facades\View::make('_themosisMetaboxRow', ['field' => $f])->render(); // Reset Id, name and value. $f_atts['id'] = $defaultId; // Reset field id attribute to its original value. $f['atts'] = $f_atts; // Update ALL attributes of the field. Contains its original id value. $f['name'] = $defaultName; // Reset name value with its original name. unset($f['value']); } ?> </tbody> </table> </td> <td class="themosis-infinite-options"> <span class="themosis-infinite-add"></span>
<?php foreach ($field['fields'] as $f) { // Set the id attribute. $defaultId = $f['id']; $f['id'] = $field['name'] . '-' . $i . '-' . $f['name'] . '-id'; // Grab the value if it exists. if (isset($field['value'][$i][$f['name']])) { $f['value'] = $field['value'][$i][$f['name']]; } // Set the name attribute. // Note: this completely change the name attribute. Do not write // any code that would need the default 'name' attribute below. $defaultName = $f['name']; $f['name'] = $field['name'] . '[' . $i . '][' . $f['name'] . ']'; // Render the field. echo Themosis\Facades\View::make('_themosisMetaboxRow', array('field' => $f))->render(); // Reset Id, name and value. $f['id'] = $defaultId; $f['name'] = $defaultName; unset($f['value']); } ?> </tbody> </table> </td> <td class="themosis-infinite-options"> <span class="themosis-infinite-add"></span> <span class="themosis-infinite-remove"></span> </td> </tr>