layotter icon indicating copy to clipboard operation
layotter copied to clipboard

Element data access in apply_filters( 'layotter/view/element' )

Open raphaelsramos opened this issue 5 years ago • 0 comments

Hello Dennis,

thank you very much for the solution you've created.

I'm doing some tests with Layotter and, in one of them, I need to access the element's data, mainly the type data, but I saw that you don't pass any element data to the layotter/view/element filter.

With that in mind, I made 2 changes to the components/element.php file:

  1. in the get() function I added a new case 'data' that returns an array ['type' => $this->type, 'title' => $this->title, 'description' => $this->description, 'icon' => $this->icon, 'order' => $this->order ]

get

  1. in the get_frontend_view() function I added a $this->get('data') to apply_filters( 'layotter/view/element' )

get_frontend_view

As these additions did not change the function purpose, but only allow access to more data, I would like them to be added definitively.

Best regards,

Raphael Ramos

raphaelsramos avatar May 08 '20 21:05 raphaelsramos