印象页面小部件在拖放后消失


Impresspages Widget disappears after drag and drop

我看到了自定义插件的奇怪行为。它的皮肤生成一些html,它工作正常。一旦我将小部件放到页面上,它仅在页面刷新后可见。当我尝试将小部件拖动到另一个位置时也是如此。

有没有人遇到过同样的问题?我不确定这是否是一个错误,或者我可能会错过代码中的某些内容。

[编辑] ipContent()->getCurrentPage()->getId() 存在一个问题,在执行任何拖放操作后为 NULL[编辑]

这是我的皮肤文件:

<div>
    <div class="form-group">
        <div class="checkbox">
            <label>
                <input id="auth-email-check-nutzung" type="checkbox"><?php echo ipSlot('text', array(
                    'id' => 'nutzungsbedingungen_' . ipContent()->getCurrentPage()->getId(),
                    'default' => 'Ich stimme den <a href="#">Nutzungebedingungen</a>  zu.',
                    'attributes' => array(
                        'id' => 'auth-email-check-nutzung-text'
                    )
                )); ?>
            </label>
        </div>
        <div class="checkbox">
            <label>
                <input id="auth-email-check-daten" type="checkbox"><?php echo ipSlot('text', array(
                    'id' => 'datenschutz' . ipContent()->getCurrentPage()->getId(),
                    'default' => 'Ich stimme der <a href="#">Datenschutzerklärung</a>  zu.',
                    'attributes' => array(
                        'id' => 'auth-email-check-daten-text'
                    )
                )); ?>
            </label>
        </div>
    </div>
    <form class="form" role="form">
        <div class="form-group">
            <label for="inputEmail1" class="control-label">Email</label>
            <input type="email" class="form-control" id="inputEmail1" placeholder="Email">
        </div>
        <div class="form-group">
            <?php if ((ipIsManagementState())) :?>
            <?php
                // Use a simulated Button to edit text and prevent any default button event
                // for user friendly inline editing
                echo ipSlot('text', array(
                    'id' => 'button' . ipContent()->getCurrentPage()->getId(),
                    'default' => 'senden',
                    'tag' => "div",
                    'class' => 'btn btn-danger auth-button btn-block',
                    'attributes' => array(
                        'data-target' => 'bs-button',
                        'id' => 'auth-email-button-div'
                    )
                )); ?>
            <?php endif; ?>
            <?php if (!(ipIsManagementState())) :?>
                <?php
                // Display real Button only on the live page with the contents of ipSlot :
                // 'id' => 'button' . ipContent()->getCurrentPage()->getId()
                echo ipSlot('text',array(
                    'id' => 'button' . ipContent()->getCurrentPage()->getId(),
                    'tag' => "button",
                    'class' => 'btn btn-danger btn-block',
                    'attributes' => array(
                        'data-target' => 'bs-button',
                        'id' => 'auth-email-button',
                        'disabled' => 'disabled'
                    )
                )); ?>
            <?php endif; ?>
        </div>
    </form>
</div>

提前谢谢。

当您重新加载页面时,"currentPage"确实存在。这就是代码工作的原因。但是,当您拖动新小部件或移动该小部件时,将使用 AJAX 加载其内容。AJAX 请求没有实际页面。因此,在某些时候无法在小部件的皮肤中获取当前页面 ID。