Comments

Swetha Yarla created an issue. See original summary.

Swetha Yarla’s picture

StatusFileSize
new5.29 KB

I have removed the deprecated methods \Drupal::config, \Drupal::l, urlInfo and changed to $this->config, Link::fromTextAndUrl , toUrl
Please find the attached patch.

guschilds’s picture

Hi Swetha,

Thanks for the patch!

Unfortunately it did not apply because of recent changes made to the 8.x-1.x branch. I re-rolled it and attached it as
youtube-deprecated-methods-2697657-3.patch. I ran into a couple of issues (with Drupal 8.0.5). First:

PHP Fatal error: Using $this when not in object context in /PATH_TO_MY_DRUPAL_8/modules/youtube/youtube.module on line 363

Are you sure \Drupal::config is deprecated? The use of $this->config() instead was causing the issues above. I could not find any mention of \Drupal::config being deprecated on its documentation, recent release notes, or Drupal's "Deprecated" page.

After removing that change I ran into:

PHP Fatal error: Class 'Link' not found in /PATH_TO_MY_DRUPAL_8/modules/youtube/youtube.module on line 248

I added use Drupal\Core\Link; to the top of the page to fix that.

Along with those two changes, I also scanned the rested of the Deprecated page and found something else in this module that has since been deprecated: SafeMarkup. I've removed it in favor of its suggested alternatives.

I've rolled these 3 changes into another patch I've attached, youtube-deprecated-methods-2697657-3a.patch. Please test that patch and let me know if it works for you.

  • guschilds committed 7e4870d on 8.x-1.x authored by Swetha Yarla
    Issue #2697657 by guschilds, Swetha Yarla: Removed depricated methods...
  • guschilds committed ec54a04 on 8.x-1.x
    Issue #2697657 by guschilds, Swetha Yarla: Removed depricated SafeMarkup...
guschilds’s picture

Status: Needs review » Fixed

Swetha,

Because I wanted to make a release involving other recent commits, I went ahead and committed everything except the $this->config stuff I mentioned having an issue with. I'm going to go ahead and close this issue, but if you are able to find information about \Drupal::config being deprecated and are able to create a working patch, please re-open this and attach it. Thanks so much for your help!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.