Book Image

SharePoint 2013 WCM Advanced Cookbook

By : JOHN CHAPMAN
Book Image

SharePoint 2013 WCM Advanced Cookbook

By: JOHN CHAPMAN

Overview of this book

Table of Contents (19 chapters)
SharePoint 2013 WCM Advanced Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a site feature to apply branding


SharePoint features provide a mechanism to add our custom branding elements to the SharePoint farm at four different scopes. Features can be scoped to the farm level, web application level, site collection level, or site (web) level. In addition to adding content, they can run custom code when activated, upgraded, deactivated, and so on in feature event receivers.

In this recipe, we will create a site (web) scoped feature that adds and configures our branding elements on the site.

How to do it...

Follow these steps to create a feature event receiver:

  1. Open the SiteBranding feature that was created when creating for our MasterPages and PageLayouts modules.

  2. Verify that both the modules are listed in the Items in the feature section.

  3. Right-click on SiteBranding.feature in the Features folder.

  4. Select Add Event Receiver as shown in the following screenshot:

  5. In our new SiteBrandingEventReceiver class, add the following constant strings that we will use for property...