PHP Warning on edit View
- This topic has 10 replies, 3 voices, and was last updated 2 years, 10 months ago by
Long Nguyen.
-
AuthorPosts
-
June 23, 2022 at 8:53 PM #36648
Ole Poetter
ParticipantHi,
When I edit a MB Viev I get a PHP Warning:
[23-Jun-2022 13:50:12 UTC] PHP Warning: Undefined array key "type" in /wp-content/plugins/meta-box/inc/field.php on line 607 [23-Jun-2022 13:50:12 UTC] PHP Warning: Undefined array key "id" in /wp-content/plugins/meta-box/inc/field.php on line 609
Kind regards,
OleJune 24, 2022 at 9:30 AM #36654Long Nguyen
ModeratorHi Ole,
Can you please share the code that creates the custom fields on your site? The custom field that is selected in the View.
It is possible that the settingtype
andid
when registering the field is missing.June 24, 2022 at 12:22 PM #36657Ole Poetter
ParticipantHi Long,
I use fields of two groups in this view.
Group 1:
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Inhalt', 'your-text-domain' ), 'id' => 'biopages_content', 'post_types' => ['u'], 'tabs' => [ 'tab_3ex0a7pbg9f' => [ 'label' => 'Inhalt', 'icon' => 'dashicons-admin-page', ], 'aussehen' => [ 'label' => 'Aussehen', 'icon' => 'dashicons-visibility', ], ], 'fields' => [ [ 'name' => __( 'Profilbild', 'your-text-domain' ), 'id' => $prefix . '_thumbnail_id', 'type' => 'image_upload', 'max_file_size' => '512kb', 'add_to' => 'beginning', 'max_file_uploads' => 1, 'force_delete' => true, 'columns' => 4, 'max_status' => false, 'tab' => 'tab_3ex0a7pbg9f', ], [ 'name' => __( 'Beschreibung', 'your-text-domain' ), 'id' => $prefix . 'beschreibung', 'type' => 'textarea', 'columns' => 8, 'tab' => 'tab_3ex0a7pbg9f', ], [ 'name' => __( 'Soziale Netzwerke', 'your-text-domain' ), 'id' => $prefix . 'soziale_netzwerke', 'type' => 'group', 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => '{choose_sn}', 'clone' => true, 'sort_clone' => true, 'add_button' => __( 'Soziales Netzwerk hinzufügen', 'your-text-domain' ), 'columns' => 6, 'fields' => [ [ 'name' => __( 'bitte wähle aus', 'your-text-domain' ), 'id' => $prefix . 'choose_sn', 'type' => 'select', 'options' => [ 'fb' => __( 'Facebook', 'your-text-domain' ), 'tt' => __( 'TikTok', 'your-text-domain' ), 'yt' => __( 'Youtube', 'your-text-domain' ), 'twi' => __( 'Twitch', 'your-text-domain' ), 'ig' => __( 'Instagram', 'your-text-domain' ), 'twt' => __( 'Twitter', 'your-text-domain' ), 'xi' => __( 'Xing', 'your-text-domain' ), 'li' => __( 'LinkedIn', 'your-text-domain' ), 'cp' => __( 'Codepen', 'your-text-domain' ), 'dr' => __( 'Dribbble', 'your-text-domain' ), 'gh' => __( 'Github', 'your-text-domain' ), 'wp' => __( 'Wordpress', 'your-text-domain' ), ], 'placeholder' => __( 'bitte wählen', 'your-text-domain' ), ], [ 'name' => __( 'Facebook', 'your-text-domain' ), 'id' => $prefix . 'fb_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Facebook Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'fb']], 'relation' => 'or', ], ], [ 'name' => __( 'TikTok', 'your-text-domain' ), 'id' => $prefix . 'tiktik_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem TikTok Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'tt']], 'relation' => 'or', ], ], [ 'name' => __( 'Youtube', 'your-text-domain' ), 'id' => $prefix . 'youtube_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Youtube Kanal', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'yt']], 'relation' => 'or', ], ], [ 'name' => __( 'Twitch', 'your-text-domain' ), 'id' => $prefix . 'twitch_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Twitch Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'twi']], 'relation' => 'or', ], ], [ 'name' => __( 'Instagram', 'your-text-domain' ), 'id' => $prefix . 'insta_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Instagram Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'ig']], 'relation' => 'or', ], ], [ 'name' => __( 'Twitter', 'your-text-domain' ), 'id' => $prefix . 'twitter_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Twitter Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'twt']], 'relation' => 'or', ], ], [ 'name' => __( 'Xing', 'your-text-domain' ), 'id' => $prefix . 'xing_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem Xing Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'xi']], 'relation' => 'or', ], ], [ 'name' => __( 'LinkedIn', 'your-text-domain' ), 'id' => $prefix . 'linkedin_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem LinkedIn Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'li']], 'relation' => 'or', ], ], [ 'name' => __( 'Codepen', 'your-text-domain' ), 'id' => $prefix . 'codepen_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem LinkedIn Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'cp']], 'relation' => 'or', ], ], [ 'name' => __( 'Dribbble', 'your-text-domain' ), 'id' => $prefix . 'dribbble_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem LinkedIn Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'dr']], 'relation' => 'or', ], ], [ 'name' => __( 'Github', 'your-text-domain' ), 'id' => $prefix . 'github_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem LinkedIn Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'gh']], 'relation' => 'or', ], ], [ 'name' => __( 'Wordpress', 'your-text-domain' ), 'id' => $prefix . 'wordpress_url', 'type' => 'url', 'placeholder' => __( 'Url zu deinem LinkedIn Profil', 'your-text-domain' ), 'visible' => [ 'when' => [['choose_sn', 'contains', 'wp']], 'relation' => 'or', ], ], ], 'tab' => 'tab_3ex0a7pbg9f', ], [ 'name' => __( 'sonstige Links', 'your-text-domain' ), 'id' => $prefix . 'sonstige_links', 'type' => 'group', 'collapsible' => true, 'default_state' => 'collapsed', 'group_title' => '{button_text}', 'clone' => true, 'sort_clone' => true, 'clone_as_multiple' => true, 'max_clone' => 10, 'add_button' => __( 'neuen Link hinzufügen', 'your-text-domain' ), 'columns' => 6, 'fields' => [ [ 'name' => __( 'Buttonbeschriftung', 'your-text-domain' ), 'id' => $prefix . 'button_text', 'type' => 'text', 'columns' => 6, ], [ 'name' => __( 'Link Url', 'your-text-domain' ), 'id' => $prefix . 'link_url', 'type' => 'url', 'placeholder' => __( 'https://', 'your-text-domain' ), 'columns' => 6, ], ], 'tab' => 'tab_3ex0a7pbg9f', ], ], ]; return $meta_boxes; }
Hmm... form the second group I can't get the php code (I'm vreating fields with the builder) in couse of following errors in console:
https://app.usebubbles.com/hkFfDssBkehi6n8FGXh5ed/mb-create-php-code
Kind regards,
OleJune 25, 2022 at 10:13 AM #36667Long Nguyen
ModeratorHi,
Please export the field group (Json file) and share it here, I will help you to check the issue with this. And you can also move this field group to the Trash and edit the View again. Let me know if the warning error disappears.
June 25, 2022 at 9:09 PM #36672Ole Poetter
ParticipantHi Long,
here is the export of the second group :
https://drive.google.com/file/d/1OjVd4Efh7ZjYAqGQw_5uHZp9TbKcU6Q8/view?usp=sharing
Kind regards,
OleJune 26, 2022 at 1:22 AM #36674Ole Poetter
ParticipantEven if I move both groups into the trash, the warning appears.
It seems there is anything in my views code?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://olnk.de/assets/css/olnkmain.css" rel="stylesheet"> <link href="https://olnk.de/assets/font-awesome/css/all.css" rel="stylesheet"> <title>{{ post.title }} @olnk.de</title> <style> body { {% if (post.bg_style.bg_style_choose.value == 'simple' ) %} background-color: {{ post.bg_style.hintergrundfarbe }}; {% else %} {% if (post.bg_style.farbverlauf.farbe|length == '2') %} background: {{ post.bg_style.farbverlauf.bg_gradient_style.value }}-gradient({{ post.bg_style.farbverlauf.bg_gradient_direction.value }}, {{ post.bg_style.farbverlauf.farbe['0'] }} 0%, {{ post.bg_style.farbverlauf.farbe['1'] }} 100%); {% elseif (post.bg_style.farbverlauf.farbe|length == '3') %} background-image: {{ post.bg_style.farbverlauf.bg_gradient_style.value }}-gradient({{ post.bg_style.farbverlauf.bg_gradient_direction.value }}, {{ post.bg_style.farbverlauf.farbe['0'] }} 0%, {{ post.bg_style.farbverlauf.farbe['1'] }} 50%, {{ post.bg_style.farbverlauf.farbe['2'] }} 100%); {% endif %} {% endif %} } </style> </head> <body> <div class="olnkwrapper"> <div class="olnkheader"> {% set field = attribute( post, '_thumbnail_id' ) %} {% for item in field %} <img src="{{ item.thumbnail.url }}" width="{{ item.thumbnail.width }}" height="{{ item.thumbnail.height }}" {% endfor %} alt="That's me!" class="portrait"> <h1 class="olnktitle"> {{ post.title }} </h1> <p class="olnklead"> {{ post.beschreibung }} </p> </div> <div class="olnklinkwrapper"> {% for clone in post.sonstige_links %} <a href="{{ clone.link_url }}" class="olnkbutton" target='_blank' rel="noopener norefferer nofollow"> {{ clone.button_text }} </a> {% endfor %} </div> <div class="onlksocialwrapper"> {% for clone in post.soziale_netzwerke %} {% if ( clone.choose_sn.value == 'fb' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.fb_url }}"> <i class="fab fa-facebook-f"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'tt' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.tiktik_url }}"> <i class="fab fa-tiktok"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'yt' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.youtube_url}}"> <i class="fab fa-youtube"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'twi' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.twitch_url }}"> <i class="fab fa-twitch"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'ig' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.insta_url }}"> <i class="fab fa-instagram"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'twt' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.twitter_url }}"> <i class="fab fa-twitter"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'xi' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.xing_url }}"> <i class="fab fa-xing"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'li' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.linkedin_url }}"> <i class="fab fa-linkedin-in"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'cp' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.codepen_url }}"> <i class="fab fa-codepen"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'dr' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.dribbble_url }}"> <i class="fab fa-dribbble"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'gh' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.github_url }}"> <i class="fab fa-github"></i> </a> {% endif %} {% if ( clone.choose_sn.value == 'wp' ) %} <a class="olnksocialitem" target="_blank" rel="noopener noreferrer nofollow" href="{{ clone.wordpress_url }}"> <i class="fab fa-wordpress-simple"></i> </a> {% endif %} {% endfor %} </div> </div> <footer> <center>{{ post.title }}'s One Link Site is proudly presented by <a href="https://olnk.de">olnk.de</a></center> </footer> </body> </html>
June 27, 2022 at 10:53 PM #36687Long Nguyen
ModeratorHi,
I've imported the field group and the View code to my local site and viewed the template on the frontend but do not see any error message.
Please share your site credentials via this contact form https://metabox.io/contact/, I will take a closer look.June 27, 2022 at 11:03 PM #36689Ole Poetter
ParticipantHi Long,
The warning does not appear when viewing the template on frontend.
It appears only when editing the view on backend.Anyway I will send the login later.
June 28, 2022 at 2:06 PM #36693Ole Poetter
Participantlogin details sent
July 1, 2022 at 1:37 PM #36762Prabakaran Shankar
ParticipantHi, it is solved?
I'm also getting the same PHP warning.July 2, 2022 at 4:12 PM #36773Long Nguyen
ModeratorHi guys,
It is possible that you've changed the ID of a/some fields but kept the old View content. Please try to delete all variables/field IDs and try to insert new ones from the Insert Field list then re-check this issue. On Ole's staging site, it is resolved.
-
AuthorPosts
- You must be logged in to reply to this topic.