// packages/block-editor/src/hooks/block-renaming.js
import { addFilter } from "@wordpress/hooks";
import { hasBlockSupport } from "@wordpress/blocks";
function addLabelCallback(settings) {
  if (settings.__experimentalLabel) {
    return settings;
  }
  const supportsBlockNaming = hasBlockSupport(
    settings,
    "renaming",
    true
    // default value
  );
  if (supportsBlockNaming) {
    settings.__experimentalLabel = (attributes, { context }) => {
      const { metadata } = attributes;
      if (context === "list-view" && metadata?.name) {
        return metadata.name;
      }
    };
  }
  return settings;
}
addFilter(
  "blocks.registerBlockType",
  "core/metadata/addLabelCallback",
  addLabelCallback
);
export {
  addLabelCallback
};
//# sourceMappingURL=block-renaming.js.map
