Fork me on GitHub

How to install the IFrame Perspective Plugin

Prerequisites

These instruction assumes that you have maven 3 based build for your site.

Add the Forge repository configuration

In the main pom.xml of the project, in the repositories section, add this repository if it is not configured there yet.

    <repository>
      <id>hippo-forge</id>
      <name>Bloomreach Forge maven 2 repository.</name>
      <url>https://maven.onehippo.com/maven2-forge/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
      <layout>default</layout>
    </repository>
        

Add version property to the project pom

In the main pom.xml of the project, in the properties section, add this property. For the correct version number, check the Release Notes page.

    <forge.iframeprspectiv.version>version.number</forge.iframeprspectiv.version>
        

Maven Dependency

Make sure you have the dependency definition in the root pom.xml of your project:

<!-- SNIP -->

<dependencyManagement>

  <!-- SNIP -->

  <dependencies>

    <!-- SNIP -->

    <!-- NOTE: You should set a property named 'forge.iframeprspectiv.version' to a version of this plugin! -->

    <dependency>
      <groupId>org.onehippo.forge.iframeprspectiv</groupId>
      <artifactId>iframeprspectiv</artifactId>
      <version>${forge.iframeprspectiv.version}</version>
    </dependency>

    <!-- SNIP -->

  </dependencies>

  <!-- SNIP -->

</dependencyManagement>
        

Add the following dependency to either cms-dependencies/pom.xml in Hippo CMS v13 or cms/pom.xml in the earlier versions:

  <!-- SNIP -->

  <dependencies>

    <!-- SNIP -->

    <dependency>
      <groupId>org.onehippo.forge.iframeprspectiv</groupId>
      <artifactId>iframeprspectiv</artifactId>
    </dependency>

    <!-- SNIP -->

  </dependencies>
        

Add the plugin configuration to the repository

If you want to add a IFrame perspective plugin, you need to add a configuration node (e.g, example-iframe-perspective) into the /hippo:configuration/hippo:frontend/cms/cms-static/ node in the repository like the following example (in System View XML format):

<?xml version="1.0" encoding="UTF-8"?>
<sv:node xmlns:sv="http://www.jcp.org/jcr/sv/1.0" sv:name="example-iframe-perspective">
  <sv:property sv:name="jcr:primaryType" sv:type="Name">
    <sv:value>frontend:plugin</sv:value>
  </sv:property>
  <sv:property sv:name="perspective.title" sv:type="String">
    <sv:value>iframe-perspective-title</sv:value>
  </sv:property>
  <sv:property sv:name="plugin.class" sv:type="String">
    <sv:value>org.onehippo.forge.iframeprspectiv.GenericIFramePerspective</sv:value>
  </sv:property>
  <sv:property sv:name="translator.id" sv:type="String">
    <sv:value>service.translator.config</sv:value>
  </sv:property>
  <sv:property sv:name="wicket.id" sv:type="String">
    <sv:value>service.tab</sv:value>
  </sv:property>
  <sv:property sv:name="iframe.src" sv:type="String">
    <sv:value>/cms/examples/whoweare.jsp</sv:value>
  </sv:property>
  <sv:property sv:name="x-frame-options" sv:type="String">
    <sv:value>ALLOW-FROM http://www.example.org</sv:value>
  </sv:property>
  <sv:node sv:name="layout.wireframe">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>frontend:pluginconfig</sv:value>
    </sv:property>
    <sv:property sv:name="center" sv:type="String">
      <sv:value>id=generic-iframe-perspective-center,body=generic-iframe-perspective-center-body,scroll=true</sv:value>
    </sv:property>
    <sv:property sv:name="linked.with.parent" sv:type="Boolean">
      <sv:value>true</sv:value>
    </sv:property>
    <sv:property sv:name="root.id" sv:type="String">
      <sv:value>generic-iframe-perspective-wrapper</sv:value>
    </sv:property>
    <sv:property sv:name="top" sv:type="String">
      <sv:value>id=generic-iframe-perspective-top,body=generic-iframe-perspective-top-body,height=35</sv:value>
    </sv:property>
  </sv:node>
</sv:node>
        

Plugin Configuration Details

You can configure the followings:

Property Example value Default value Description
perspective.title iframe-perspective-title Generic IFrame Panel Resource bundle key in classpath:org/onehippo/forge/iframeprspectiv/GenericIFramePerspective*.properties for the title for this perspective. See Setting Perspective Plugin Title section for detail.
iframe.src http://www.onehippo.org The initial source of the IFrame element
icon-prefix my-iframe-perspective- generic-iframe-perspective- The prefix of the icon for this perspective. For example, if the prefix of the icon is 'generic-iframe-perspective-' and the suffix is '.png', then 'classpath:/org/onehippo/forge/iframeprspectiv/generic-iframe-perspective-32.png' resource will be used for the perspective icon.
icon-suffix .gif .png The suffix of the icon for this perspective. For example, if the prefix of the icon is 'generic-iframe-perspective-' and the suffix is '.png', then 'classpath:/org/onehippo/forge/iframeprspectiv/generic-iframe-perspective-32.png' resource will be used for the perspective icon.
x-frame-options ALLOW-FROM http://www.example.org Optionally set X-Frame-Options response header if configured.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options for details.
content-security-policy Refer to the specification Optionally set Content-Security-Policy response header if configured.
See https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Introducing_Content_Security_Policy and https://www.owasp.org/index.php/Content_Security_Policy for details.
x-content-security-policy Refer to the specification Optionally set X-Content-Security-Policy response header if configured.
See https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Introducing_Content_Security_Policy and https://www.owasp.org/index.php/Content_Security_Policy for details.
x-webkit-csp Refer to the specification Optionally set X-Webkit-CSP response header if configured.
See https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Introducing_Content_Security_Policy and https://www.owasp.org/index.php/Content_Security_Policy for details.
iframe.* If there is any property with name starting with 'iframe.', then the remaining part after 'iframe.' will be added as an additional attribute of the iframe element. For example, if you add 'iframe.name' with value, 'myiframe', then the iframe will have name="myiframe" HTML attribute.

Setting Perspective Plugin Title

The perspective.title configuration parameter lets you customize the title of the IFrame perspective plugin.

If the parameter is set to "iframe-perspective-title" for example, then the title of this perspective plugin will be read from the resource bundle value ("Generic IFrame Panel" by default) found by the bundle key, "iframe-perspective-title".

Therefore, to customize the title of your IFrame perspective plugin, you should shadow classpath:org/onehippo/forge/iframeprspectiv/GenericIFramePerspective*.properties in your CMS web application project (cms/) (e.g. add cms/src/main/resources/org/onehippo/forge/iframeprspectiv/GenericIFramePerspective.properties).

And add a resource bundle key ("iframe-perspective-title" or something else like "my-iframe-perspective-title" for example) with a custom title string value like the following example:

# picked up when the parameter is set to "iframe-perspective-title"
iframe-perspective-title=Generic IFrame Panel

# picked up when the parameter is set to "my-iframe-perspective-title"
my-iframe-perspective-title=My IFrame Panel