When Backdrop dropped the "theme process" layer, it made changes on how variables containing css classes are passed to templates. In D7, the process layer flattened $classes_array into a string $classes before passing it to the template. With this change, Backdrop charged the template with flattening the array, AND also changed the names of the variables. In Backdrop, $classes is now an array of css classes that must be flattened by the template before outputting.$classes_array was completely abandoned.
Entity Plus did not adapt to this change - perhaps for backward compatibility. So, now we are in a situation when there are TWO css class variables available to templates, after running template_preprocess_entity_plus(). We have $classes, which contain an array of css classes built by core's template_preprocess(), and we have $classes_array, built during template_preprocess_entity_plus(). Unlike $classes which (for entities that use EntityPlusController) typically contains one css class, entity-plus, the variable provided by E+, $classes_array, contains (in addition) css classes derived from the actual name of the custom entity.
On the other hand, the template provided by E+ uses $classes to produce the output.
So we are missing out on the richer array of css classes provided in $classes_array, which is never used by entity_plus.tpl.php.
Proposed solution:
At this point it would be unwise removing $classes_array, provided by E+ preprocessor, as custom modules that use EntityPlusController may depend on it. I suggest that we actually keep both, $classes and $classes_array, but merge them during the E+ preprocessing so that they contain identical css classes.
We also need to fix the docblock for entity_plus.tpl.php to correctly say that $classes is an array, not a string (which has been the case since the removal of the theme process layer in Backdrop).
When Backdrop dropped the "theme process" layer, it made changes on how variables containing css classes are passed to templates. In D7, the process layer flattened
$classes_array
into a string$classes
before passing it to the template. With this change, Backdrop charged the template with flattening the array, AND also changed the names of the variables. In Backdrop,$classes
is now an array of css classes that must be flattened by the template before outputting.$classes_array
was completely abandoned.Entity Plus did not adapt to this change - perhaps for backward compatibility. So, now we are in a situation when there are TWO css class variables available to templates, after running
template_preprocess_entity_plus()
. We have$classes
, which contain an array of css classes built by core'stemplate_preprocess()
, and we have$classes_array
, built duringtemplate_preprocess_entity_plus()
. Unlike$classes
which (for entities that useEntityPlusController
) typically contains one css class,entity-plus
, the variable provided by E+,$classes_array
, contains (in addition) css classes derived from the actual name of the custom entity.On the other hand, the template provided by E+ uses
$classes
to produce the output.So we are missing out on the richer array of css classes provided in
$classes_array
, which is never used byentity_plus.tpl.php
.Proposed solution:
At this point it would be unwise removing
$classes_array
, provided by E+ preprocessor, as custom modules that useEntityPlusController
may depend on it. I suggest that we actually keep both,$classes
and$classes_array
, but merge them during the E+ preprocessing so that they contain identical css classes.We also need to fix the docblock for
entity_plus.tpl.php
to correctly say that$classes
is an array, not a string (which has been the case since the removal of the theme process layer in Backdrop).