Create a Laravel PHP Media Library inspired by WordPress

I'm currently working on a Laravel media library. I look at WordPress from a user perspective. The Media Library tab displays the images you can select.

  • I checked TWO images (Shift + click) inside "Insert Media"
  • I switch to "Best Image" and check ONE image for Featured Image.
  • When I switch back to Insert Media, it remembers the two previously selected images and forgets the marked “Best Image”.

enter image description here

How WordPress "remembers" which images are checked in the "Insert Media" mode. Is this what they use with some of the data stored in the model? Because every time I switch between the Insert Media and Featured Image, element of ULchange attribute id: (__attachments-view-xxx).

When I just use simple javascript, can I put some ID in an associative array? Does this mean that every time I switch back to Insert Media, do I need to find the appropriate images to re-check them? What if you have hundreds of media items to search every time ...

, - , , , ... WordPress "" -. - , ?

+4

Source: https://habr.com/ru/post/1613993/


All Articles