The variables inside templates are often called $content when what we actually meant was the contents of the template. I propose that we change the variable name form "content" (which in the drupal world seems to mean node) to "contents" which should indicate "the stuff in this template" and confuse people less.

Before:

<div id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>

  <?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
  <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
<?php endif;?>
  <?php print render($title_suffix); ?>

  <div<?php print $content_attributes; ?>>
    <?php print $content ?>
  </div>
</div>

After:

<div id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>

  <?php print render($title_prefix); ?>
<?php if ($block->subject): ?>
  <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
<?php endif;?>
  <?php print render($title_suffix); ?>

  <div<?php print $contents_attributes; ?>>
    <?php print $contents ?>
  </div>
</div>

Comments

jenlampton’s picture

Issue summary: View changes

added code samples

jenlampton’s picture

Issue summary: View changes

line break

star-szr’s picture

Version: 8.0.x-dev » 9.x-dev
Issue summary: View changes
Status: Active » Postponed

Unfortunately I think it's too late for this for D8, moving to D9.

catch’s picture

Version: 9.x-dev » 8.3.x-dev

Could we not duplicate the variable and update the templates to use the new one?

lauriii’s picture

Status: Postponed » Active

We definitely could work on this during 8.x life cycle. I'm not sure if I'm convinced with the proposed solution but I agree that there is confusion caused by the name of this variable. Maybe it would be useful to think what other possible solution there would be.

joelpittet’s picture

Version: 8.3.x-dev » 9.x-dev
Status: Active » Postponed

I don't think adding the BC layer and duplicate variable names is worth the effort here. The gain is minor, could duplicate the memory and the variable namespaces doubles for the life of D8

apaderno’s picture

Is contents the right word? The only definition I find for contents is the list of chapters or articles or parts that are in the book, with the number of the page they begin on.

I think there is a difference between talking of the site content and the content of a template. Users should not get confused between them, since the context is totally different.

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.

xjm’s picture

Status: Postponed » Closed (won't fix)

Based on #5 and my own lexical inclinations, I think this issue is a wontfix. Thanks!