@wordpress/core-data
Version:
Access to and manipulation of core WordPress entities.
28 lines (25 loc) • 642 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useEntityId;
var _element = require("@wordpress/element");
var _entityContext = require("../entity-context");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Hook that returns the ID for the nearest
* provided entity of the specified type.
*
* @param {string} kind The entity kind.
* @param {string} name The entity name.
*/
function useEntityId(kind, name) {
const context = (0, _element.useContext)(_entityContext.EntityContext);
return context?.[kind]?.[name];
}
//# sourceMappingURL=use-entity-id.js.map