Custom element stopped rendering after upgrade to Pro 5.1.x because cs_attr_class() function is gone

The cs_attr_class() function was removed from Cornerstone at some point between Pro 5.0.8 and Pro 5.1.4. This change broke a custom element I had written, causing a fatal error in its render function:

PHP Fatal error: Uncaught Error: Call to undefined function cs_attr_class() …

The Element API Primer and Element API Reference still show examples that use this function, and the changelog doesn’t mention that it was removed.

Was it removed accidentally, or does the documentation just need to be updated?

Thanks!

Hello @fundibu,

Thanks for writing in! I believe that this is a bug in the latest release. This has already been added to our issue tracker and will be looked into by our development team. I cannot make any promises relating to a fix at this stage. I will add a note to the tracker referencing your report though so our dev team can see there are multiple reports of the issue.

Please bear with us.

Hi @fundibu,

I apologize, that function was intentionally removed. We’ll look at getting the documentation updated. You can simply use an array in cs_atts now. It will automatically combine and escape arrays.

cs_atts(['class' => [ $mod_id, 'custom-class' ]]); 

@alexander,

Understood. Thanks!

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.