Message Boards

Resources Importer doesn't work at all for 7.1, documentation is obsolete

Lukas Grygar, modified 5 Years ago.

Resources Importer doesn't work at all for 7.1, documentation is obsolete

New Member Posts: 4 Join Date: 4/17/16 Recent Posts

Full topic name: Resources Importer doesn't work at all for 7.1, documentation is obsolete and Liferay Inc. uses undocumented Site Initializer

 

Hello,

as documentation https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/importing-resources-with-a-theme states "The Resources Importer is deprecated as of Liferay Portal CE 7.1.", but actually depracated in
software development in general doesn't mean that functionality doesn't work, but resources importer at 7.1 work just partialy. Please don't find my post offensive I'll just describe current state of things.

If I use Resources Importer (sitemap.json etc.) in 7.1 theme then resources (templates, structures and content) are imported only if you preview theme at Site Templates section.

If you create new Site from theme which uses resorces importer then new site is created but no content is imported, there are no site pages.

EDIT 15.1.2018:  scenario with creating new Site from theme works with theme build by Blade

 

Liferay Inc. uses Site Innitializer (https://issues.liferay.com/browse/LPS-83770) to import resources with their themes but this aproach is not documented anywhere due to fact that API is not baked yet (https://community.liferay.com/forums/-/message_boards/message/110952258/maximized).

So currently it's really pain to develop 7.1 themes for Liferay Marketplace, due to "not sell empty house" requirement.

 


Another problem with documentation I found is that recommended tool to develop Liferay 7.1 themes is Liferay Theme Generator (Gulp tool) (version 8.0.0-rc.1, I use Windows 10), which actually doesn't work properly for styled theme due to fact that Clay is not imported.

Blade tools works fine, means that I'm able to build theme extended from styled theme which imports Clay.

 


I'm sorry that I didn't reported this issue to bugtracking system, but password doesn't match my forum/marketplace account and I didn't recieved password reset email.

 

After finishing writing this topic and looking for relevant links to support my conclusions I know you guys from Liferay Inc. know about these problems but it would be nice if someone give some kind of information about current state of things.

 

P.S. I'm going to take a look at Site Initializer (https://github.com/liferay/liferay-portal/tree/master/modules/apps/frontend-theme-westeros-bank) and reverse engineer it a little bit, but it would be nice if every single Liferay developer wouldn't do the same in the future.

Lukas Grygar, modified 5 Years ago.

RE: Resources Importer doesn't work at all for 7.1, documentation is obsole

New Member Posts: 4 Join Date: 4/17/16 Recent Posts

So after some progress I discovered that Resources Importer in 7.1 does not import images if they are used in "advanced" structures and templates and it also creates side bug that if I want to create Site from template then pages are not created according to sitemap.json due to fact that theme contains structures and templates which contains image.

 

Replication:

1.) Create Liferay 7.1 Theme using Blade CLI Graddle wrapper in Liferay Workspace

2.) Create structure, template and webcontent

{
  "availableLanguageIds": [
    "en_US"
  ],
  "defaultLanguageId": "en_US",
  "fields": [
    {
      "label": {
        "en_US": "Image"
      },
      "predefinedValue": {
        "en_US": ""
      },
      "style": {
        "en_US": ""
      },
      "tip": {
        "en_US": ""
      },
      "dataType": "image",
      "fieldNamespace": "ddm",
      "indexType": "text",
      "localizable": true,
      "name": "Img",
      "readOnly": false,
      "repeatable": false,
      "required": false,
      "showLabel": true,
      "type": "ddm-image"
    }
  ]
}
<#if Img.getData()?? && Img.getData() != "">
    <img src="${Img.getData()}" />
</#if>
<?xml version="1.0"?>

<root>
    <dynamic-element name="Img" type="image" index-type="text" instance-id="mhto">
        <dynamic-content><![CDATA[[$FILE=1.png$]]]></dynamic-content>
    </dynamic-element>
</root>

3.) Create sitemap.json

{
  "layoutTemplateId": "1_column",
  "publicPages": [
    {
      "friendlyURL": "/home",
      "name": "Home",
      "title": "Home",
      "layoutTemplateId": "1_column",
      "columns": [
        [
          {
            "portletId": "com_liferay_journal_content_web_portlet_JournalContentPortlet",
            "portletPreferences": {
              "articleId": "Img.xml",
              "groupId": "${groupId}",
              "portletSetupShowBorders": "false"
            }
          }
        ]
      ]
    },
    {
      "friendlyURL": "/login",
      "name": "Login",
      "title": "Login",
      "layoutTemplateId": "1_column",
      "columns": [
        [
          {
            "portletId": "com_liferay_login_web_portlet_LoginPortlet",
            "portletPreferences": {
              "portletSetupShowBorders": "false"
            }
          }
        ]
      ]
    }
  ]
}

4.) build theme blade gw build

5.) deploy theme to Liferay 7.1 CE GA2

6.) Preview Site Template and see that there is no Image visible.

7.) create Site from Site Template and there are no pages created according to sitemap and there are no web content and documents imported

 

If I use same theme at Liferay 7.0 CE GA7 it works.

 

 

If I use just basic webcontent it works with 7.1:

 

Structure

{
    "availableLanguageIds": [
        "en_US"
    ],
    "defaultLanguageId": "en_US",
    "fields": [
        {
            "label": {
                "en_US": "Content"
            },
            "predefinedValue": {
                "en_US": ""
            },
            "style": {
                "en_US": ""
            },
            "tip": {
                "en_US": ""
            },
            "dataType": "html",
            "fieldNamespace": "ddm",
            "indexType": "keyword",
            "localizable": true,
            "name": "content",
            "readOnly": false,
            "repeatable": false,
            "required": false,
            "showLabel": true,
            "type": "ddm-text-html"
        }
    ]
}

 

Template

${content.getData()}

 

Web content

<?xml version="1.0"?>

<root available-locales="en_US" default-locale="en_US">
    <dynamic-element name="content" type="text_area" index-type="keyword" index="0">
        <dynamic-content language-id="en_US">
            <![CDATA[
<div>
    <strong>Copyright</strong> Example Company &copy; 2019
    <p><img src="[$FILE=1.png$]" />
</div> ]]>
        </dynamic-content>
    </dynamic-element>
</root>

 

 

thumbnail
Vitaliy Koshelenko, modified 4 Years ago.

RE: Resources Importer doesn't work at all for 7.1, documentation is obsole

Expert Posts: 319 Join Date: 3/25/11 Recent Posts
Hi Lukas,

Have you managed to fix/workaround this?

I have a similar issue:

https://liferay.dev/forums/-/message_boards/message/114209073

Regards,Vitaliy