XF 2.1 Having trouble getting entity values on edit page

Matt C.

Well-known member
I'm having trouble getting an entity's values on the edit page. On top of that I'm getting a few errors. The only field that seems to work is the platform field. And the description field value is always "A" for whatever reason.

190694

Here is my edit template:
Code:
<xf:title>{{ phrase('ah_mm_edit_match') }}</xf:title>

<xf:form action="{{ link('matchmaking/save', $match) }}" ajax="true" class="block">

    <div class="block-container">
        <div class="block-body">
            <xf:macro template="ah_mm_match_edit_macros" name="title"
                arg-match="{$match}" />
         
            <xf:macro template="ah_mm_match_edit_macros" name="platform"
                arg-match="{$match}" />
         
            <xf:macro template="ah_mm_match_edit_macros" name="voice"
                arg-match="{$match} "/>
         
            <xf:macro template="ah_mm_match_edit_macros" name="description"
                arg-match="{$match} "/>
        </div>
     
        <xf:submitrow icon="save" rowtype="simple" sticky="true" class="js-overlayClose"></xf:submitrow>
    </div>
</xf:form>

Here is my edit macros template:
Code:
<xf:macro name="title" arg-match="!">
    <xf:textboxrow
        name="title"
        label="{{ phrase('title') }}"
        type="match"
        textbox-value="{$match.title}"
        maxlength="{{ max_length($match, 'title') }}"
        placeholder="{{ phrase('title...') }}" />
</xf:macro>

<xf:macro name="platform" arg-match="!">
    <xf:radiorow name="platform" value="{$match.platform}" label="{{ phrase('type') }}">
            <xf:option value="PC" label="{{ phrase('ah_mm_pc') }}"></xf:option>
            <xf:option value="PlayStation 4" label="{{ phrase('ah_mm_playstation_4') }}"></xf:option>
            <xf:option value="Xbox One" label="{{ phrase('ah_mm_xbox_one') }}"></xf:option>
    </xf:radiorow>
</xf:macro>

<xf:macro name="description" arg-match="!">
        <xf:textarearow name="description" value="{$match.description}" data-min-height="200" label="{{ phrase('description') }}" />
</xf:macro>

<xf:macro name="voice" arg-match="!">
    <xf:checkboxrow label="{{ phrase('ah_mm_microphone') }}">
        <xf:option name="voice" checked="{$match.voice}"
            label="{{ phrase('ah_mm_do_you_have_a_microphone') }}" />
    </xf:checkboxrow>
</xf:macro>

Also here is the backend code for editing the entity:
PHP:
protected function matchEdit(\AH\Matchmaking\Entity\Match $match)
{
    $viewParams = [
        'match'       => $match,
    ];

    return $this->view('AH\Matchmaking:Match\Edit', 'ah_mm_match_edit', $viewParams);
}

/**
* @param ParameterBag $parameterBag
* @return \XF\Mvc\Reply\View
* @throws \XF\Mvc\Reply\Exception
*/
public function actionEdit(ParameterBag $params)
{
    $match = $this->assertViewableMatch($params->match_id);
    if (!$match->canEdit($error))
    {
        return $this->noPermission($error);
    }

    return $this->matchEdit($match);
}

If someone could give it a look, and see what I've done wrong, that would be really helpful. Thank you.
 
Last edited:
This is because of the spaces in your macro calls.

Code:
<xf:macro template="ah_mm_match_edit_macros" name="voice"
                arg-match="{$match} "/>
          
            <xf:macro template="ah_mm_match_edit_macros" name="description"
                arg-match="{$match} "/>

Notice the white space between } and “ :)


Fillip
 
Top Bottom