Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Parent issue: #2393329: Replace all drupal_render calls with the service, and inject it, if possible.
Problem/Motivation
drupal_render() was marked as deprecated, though its still called in quite some places.
Proposed resolution
- Avoid rendering manually by letting the template who is printing the variable render it.
- Inject the renderer service into service, which uses drupal_render()
- Use \Drupal::service('renderer')->render() for old prodecural code.
Remaining tasks
- Find all the actionable fixes: Search for
drupal_render(
- Create a Patch
- Review
User interface changes
None
API changes
None
Beta phase evaluation
Issue category | Task because this removes usages of a deprecated function. |
---|---|
Issue priority | Not critical because the function in question is not to be removed in this release cycle. |
Comment | File | Size | Author |
---|---|---|---|
#18 | replace_drupal_render-2471811-18.patch | 1.21 KB | dimaro |
#18 | interdiff-2471811-11-18.txt | 1.24 KB | dimaro |
#11 | replace_drupal_render-2471811-11.patch | 1.41 KB | zaurav |
#9 | replace_drupal_render-2471811-9.patch | 2.66 KB | zaurav |
#7 | replace_drupal_render-2471811-6.patch | 1.24 KB | zaurav |
Comments
Comment #1
heddnComment #2
heddnComment #3
heddnComment #4
cilefen CreditAttribution: cilefen commentedComment #5
heddnComment #6
cilefen CreditAttribution: cilefen commentedComment #7
zauravComment #8
zauravComment #9
zauravAdhering to coding standards. Breaking down 80+char line.
Comment #11
zauravOne more time. Last patch had two patches rolled into it.
Comment #15
Mile23Are we sure this information is correct and relevant? This comment mentions a behavior that doesn't seem to be tested by the test.
Comment #16
keopxComment #17
keopxComment #18
dimaro CreditAttribution: dimaro at La Drupalera by Emergya commentedI think the comment is not necessary because the service is not used.
Also I remove "use Drupal\Core\Cache\CacheableDependencyInterface" because not being used.
@Mile23 Do you agree?
Comment #19
webchickThanks @willzyx for all your work on these! Unfortunately, these issues need to be postponed to 8.1.x at least. See the allowed beta changes policy and the comment in #2393329-39: Replace all drupal_render calls with the service, and inject it, if possible..