So I am trying to create a custom banner based on user uploaded image using this
https://www.webwash.net/how-to-create-powerful-container-paragraphs-in-drupal-8/
I am using Drupal 9 and whenever I try to do this
$image = $paragraph->field_image->entity->url();
I get this error
Error: Call to undefined method Drupal\file\Entity\File::url() in tm_preprocess_paragraph__main_banner()
I am not sure if the function changed from Drupal 8 but so far everything that works in Drupal 8 is working in Drupal 9
aaah for anyone who faced this issue.. i literally just found the solution
in simply use createFileUrl(); instead of url()
Related
I have created a contact form on our website, I thought it worked in the past, but now when you click the submit button nothing happens and a blue spinning wheel comes up and nothing happens.
Does anyone know what it can be? Some manage to fix it by deleting the password-protect plugin but I do not have that enabled.
Java error from console
Link to the website with the contact form: https://www.hamarbilpleie.no/kontakt-oss/
Dubug plugin result
[03-Mar-2021 20:31:48 UTC] PHP Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/contact_form.php on line 261
[03-Mar-2021 20:31:48 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to cs_phpmailer_init() must be an instance of PHPMailer, instance of PHPMailer\PHPMailer\PHPMailer given, called in /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php on line 287 and defined in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/functions.php:298 Stack trace:
#0 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(287): cs_phpmailer_init(Object(PHPMailer\PHPMailer\PHPMailer))
#1 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
#2 /home/2/h/hamarbilpleie/www/wp-includes/plugin.php(551): WP_Hook->do_action(Array)
#3 /home/2/h/hamarbilpleie/www/wp-includes/pluggable.php(494): do_action_ref_array('phpmailer_init', Array)
#4 /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/contact_form.php(280): wp_mail(Array, 'Foresp\xC3\xB8rsel fr...', 'F\xC3\xB8lgende henve...', Array)
#5 /home/2/h/hamarbilpleie/www/wp-includes/class-wp-hook.php(287): cs_theme_contact_form('')
#6 /home/2/h/hamarbilple in /home/2/h/hamarbilpleie/www/wp-content/themes/carservice/functions.php on line 298
Probably you are having a bug in Javascript. What you have to do is, open up the Developer Tools in your browser, then goto Console tab. You would find the error messages there. Copy that error and share it with us.
EDIT
I can see that there's a 500 Internal Server Error (based on the screenshot you provided) when the data is submitted to the server. What you have to do is, see if there's any error log created inside your server. It would have some information regarding what is causing the issue. Please share it with us. If you are not able to see it, please follow this: Debugging in WordPress
EDIT 2
It appears that you are having two issues in your theme's functions.php file. It's using one depreciated function and for the other probably because of old code. The line numbers are #261 and #298 (/wp-content/themes/carservice/functions.php). The easy would be to ask your theme developer to get it fixed for you. If you have the update available for your theme and plugins, make sure you update it. Kindly note that, if you have done any modifications on the functions.php file, instead of doing it in a child theme, those changes would be overwritten when you update the theme.
After some digging and discussion, I found out that the theme had not been updated for ages. But to find an update for this was not easy. For some reason, it did not automatically update from WP. But it is fixed now. Thanks for the tips and hints, guys.
I would love to get some help here. I enabled the forums module which is part of Drupal core. When I go to add a container, I get the following error:
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 279 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 403 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
Notice: Trying to get property of non-object in taxonomy_overview_terms() (line 405 of D:\Development\drupal\sites\all\modules\taxonomy\taxonomy.admin.inc).
I have tried to delete the tables and reinstall the module. I have the same module enabled on another one of our sites (which is identical in structure). But I do not get these errors on it. Anyone know how to fix this?
Thanks!
FWIW I debugged a similar issue and found that the 'forum' vocabulary nav variable (forum_nav_vocabulary) was not set in my installation, and that just plain breaks things. In the forum module there are a number of calls to variable_get('forum_nav_vocabulary', ''), but unfortunately if it is not set, using an empty vid has not been properly catered for.
If you set it, make sure to use the vid and not the machine name (i.e. the number, not the name). You will need to do this with drush, via the db, or using devel module's variable editor.
I have some code from a training course, where I am studying Drupal Module Development. I am using the Form API which wants the $form_state to be passed by reference. That means that I enter the variable as &$form_state. I did that, so I cannot figure out why I am getting an error that reads:
Warning: Parameter 1 to form_fun_cake() expected to be a reference, value given in
drupal_retrieve_form() (line 806 of /media/sf_sandbox/drupal-mod-dev/includes/form.inc).
The form is just manufactured for training purposes. I pasted it here: http://pastebin.com/A8VsBzsL
The error suggests that the problem is not originating in my code, other than the fact that Parameter 1 to form_fun_cake() is the code inside my own /sites/all/modules/custom/form_fun/
I have put this into two separate drupal installations with the same result. Of course, both are from the same code base of Drupal core, version 7.26.
Any suggestions? Any idea why Drupal would report that the parameter is not passed by reference?
Thanks,
Bruce
You're just missing the $form argument:
function form_fun_cake($form, &$form_state) {
...
}
It's possible the code you're adapting was meant for Drupal 6.
I`m updating from 6.x to 7.x. I have updated core, modules and now working on updating a theme. For this purpose I downloaded ZEN as a base theme and started to develop a new sub-theme (from the theme of previous version). And with this new "sub-theme" selected I get this errors:
Recoverable fatal error: Argument 2 passed to db_query() must be an array, null given, called in ~modules/php/php.module(80) : eval()'d code on line 11 and defined in db_query() (line 2342 of ~includes/database/database.inc).
I tried to switch to garland - on garland everything is ok.
I tried to switch to bartik - and get same error.
So the problem is not in theme (I checked my new sub-theme couple times).
I checked all blocks (to find PHP with error code), corrected some problems, but still got this error.
I also tried to switch off almost all blocks in bartik (except for 'navigation' and 'Main page content'), but still got this error.
I can`t find out there is problem. Is there any method how can I detect problem place to be able to fix it?
For now I checked all blocks, all themes, all content with php filter. After that I cleared cache and still got this error. And the most amazing thing that I get no error with garland.
What can I do to find out where is problem?
Drupal 6's db_query function expects the first argument to be a parameterized query, and the rest of the arguments to be replacements for them in the correct order.
Drupal 7, however has PDO support and ye db_query function's second argument should be an array of placeholder => value pattern.
db_query('SELECT * from somewhere where something = :that ', array(':that' => 'beer'));
Now you know what is wrong so find this in your theme.
I've been encountering an error when having too many options in a drop down. It simply freezes if there are over 222 options.
I'm running on PHP 5.3.5, but this also happens when running on PHP 5.3.13. Curiously, this issue DOES NOT happen when using 5.2.27.
I've been trying to back trace the error, and I believe it's got something to do with the preg_replace_callback() function called inside do_shortcode () in /includes/shortcodes.php on row 62.
Has any of you encountered the same issue, and do you happen to know how to solve it?
Thanks