Example #1
0
 /**
  * Handles editable type
  *
  * @param \BEM\Context $ctx
  * @param \BEM\Json    $json
  *
  * @return mixed
  */
 public function handleEditable(Context $ctx, Json $json, $editable)
 {
     $ctx->tag('a');
     $ctx->attr('data-is-link', 1);
     $ctx->content("<?= ArrayHelper::getValue(\${$this->target($editable)}, \"{$editable['key']}.anchor\", '#UNDEFINED') ?>");
     $ctx->attr('href', ['unsafe' => "<?= ArrayHelper::getValue(\${$this->target($editable)}, \"{$editable['key']}.href\", '#UNDEFINED') ?>"]);
 }
Example #2
0
    /**
     * Handles editable type
     *
     * @param \BEM\Context $ctx
     * @param \BEM\Json    $json
     * @param array        $editable
     *
     * @return mixed
     */
    public function handleEditable(Context $ctx, Json $json, $editable)
    {
        $ctx->content(<<<php
<img src="<?= ArrayHelper::getValue(\${$this->target($editable)}, "{$editable['key']}.src", 'UNDEFINED') ?>" alt="<?= ArrayHelper::getValue(\${$this->target($editable)}, "{$editable['key']}.alt", 'UNDEFINED') ?>">
php
);
    }
 /**
  * Handles editable type
  *
  * @param \BEM\Context $ctx
  * @param \BEM\Json    $json
  * @param array        $editable
  *
  * @return mixed
  */
 public function handleEditable(Context $ctx, Json $json, $editable)
 {
     $ctx->content("<?= \${$this->target($editable)}['{$editable['key']}'] ?>");
 }