Hey,
You can achieve that using the useCMEditViewDataManager() method which is provided by strapi under your src/plugins/pluginName/admin/src/components/folder/index.js. You can add it to your mentioned file.
This will help you in fetching the Edit record detail and UID of current previewing collection. Below will answer both of your question.
import { useCMEditViewDataManager } from '@strapi/helper-plugin'; // FOR IMPORT
--------------------------
const { allLayoutData, modifiedData } = useCMEditViewDataManager();
const { uid } = allLayoutData.contentType;
// CHECK IF UID CONTROLLER IS ALLOWED OR NOT
const allowedUID = ['api::blog.blog','api::page.page'];
if(isCreatingEntry || !allowedUID.includes(uid)) {
return null;
}
console.log(modifiedData) // FETCH YOU RECORD DETAIL
// YOUR CODE BLOCK
return (
<>
<Button />
</>
)
Hope this helps you ![]()
Thanks