Search code examples
apostrophe-cms

How to remove items from the admin bar


The Apostrophe CMS is clear enough on how to add items to the admin bar.

I am trying to remove items (some pieces that we have created) so that we can choose who sees what.

I tried setting an empty array to remove every object

'apostrophe-admin-bar': {
  items: [],
  ...
}

to no avail.

Any help or guidance is appreciated.


Solution

  • A colleague and I figured it out. In the index.js of the piece, add this:

    construct(self, options) {
      if (self.name === 'pieceNameGoesHere' {
        self.addToAdminBar = Function.prototype;
      }
    }