0

I'm using Sulu + Sulu/Articles. Just added the property images to the default articles template:

<?xml version="1.0" ?>
<template xmlns="http://schemas.sulu.io/template/template"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xi="http://www.w3.org/2001/XInclude"
          xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/template-1.0.xsd">

    <key>article_default</key>

    <view>articles/article_default</view>
    <controller>SuluArticleBundle:WebsiteArticle:index</controller>
    <cacheLifetime>144000</cacheLifetime>

    <meta>
        <title lang="en">Default</title>
        <title lang="de">Standard</title>
    </meta>

    <tag name="sulu_article.type" type="article"/>

    <properties>
        <section name="highlight">
            <properties>
                <property name="title" type="text_line" mandatory="true">
                    <meta>
                        <title lang="en">Title</title>
                        <title lang="de">Titel</title>
                    </meta>

                    <params>
                        <param name="headline" value="true"/>
                    </params>

                    <tag name="sulu_article.article_title"/>
                </property>

                <property name="pageTitle" type="text_line" mandatory="true">
                    <tag name="sulu_article.page_title"/>
                </property>

                <property name="routePath" type="route">
                    <meta>
                        <title lang="en">Resourcelocator</title>
                        <title lang="de">Adresse</title>
                    </meta>
                </property>
            </properties>
        </section>

        <property name="article" type="text_editor">
            <meta>
                <title lang="en">Article</title>
                <title lang="de">Artikel</title>
            </meta>
        </property>

        <property name="images" type="media_selection">
            <meta>
                <title lang="en">Images</title>
            </meta>

            <params>
                <param name="types" value="image,video"/>
                <param name="displayOptions" type="collection">
                    <param name="leftTop" value="true"/>
                    <param name="top" value="true"/>
                    <param name="rightTop" value="true"/>
                    <param name="left" value="true"/>
                    <param name="middle" value="false"/>
                    <param name="right" value="true"/>
                    <param name="leftBottom" value="true"/>
                    <param name="bottom" value="true"/>
                    <param name="rightBottom" value="true"/>
                </param>
                <param name="defaultDisplayOption" value="left"/>
                <param name="formats" type="collection">
                    <param name="640x960" />
                </param>
            </params>
        </property>
    </properties>
</template>

But on my requests in the api I can't seem to get it listed:

http://sulu.test/admin/api/articles?sortBy=authored&sortOrder=desc&locale=en&type=article&fields=id,images,typeTranslation,title,changerFullName,authorFullName,changed,authored&limit=20&expandIds=

I added the field "images" but it's not listed on the response of the Api:

{
    "articles": [
        {
            "id": "2dc65e7f-aa2a-4872-90c2-1d3a6efb4dbc",
            "title": "Hello World",
            "typeTranslation": "Article",
            "changerFullName": "Adam Ministrator",
            "creatorFullName": "Adam Ministrator",
            "changed": "2018-01-28T04:08:57+0000",
            "created": "2018-01-28T04:08:57+0000",
            "authored": "2018-01-28T04:08:57+0000",
            "authorFullName": "Adam Ministrator",
            "published": "2018-01-28T04:08:57+0000",
            "publishedState": true,
            "localizationState": {
                "state": "localized"
            },
            "authorId": "1",
            "creatorContactId": "1",
            "changerContactId": "1"
        },
    ]
}

Thanks for your help!

JohnnyAce
  • 3,569
  • 9
  • 37
  • 59
  • Have you tried deleting the symfony cache at `var/cache`? And does this field already hold a value? Can you try assigning an image and see if the response contains the field then? – Daniel Rotter Jan 30 '18 at 09:54
  • @DanielRotter thank you for your response, I did that and it didn't work. – JohnnyAce Feb 04 '18 at 01:06
  • What didn't work? Please be more specific. Do you see the UI element for the images field in the Admin? – Daniel Rotter Feb 05 '18 at 10:06

0 Answers0