Anyone can help me to change the following  tpl code into twig code ???

Hamdan Shafiq
Hamdan Shafiq used Ask the Experts™
on
<div class="form-group">
            <label class="col-sm-2 control-label"><?php echo $entry_allowed_domestic_methods; ?></label>
            <div class="col-sm-4">
              <div class="well well-sm" style="height: 150px; overflow: auto;">
                <?php foreach ($allowed_domestic_methods as $key=>$dservice) { ?>
                <div class="checkbox">
                  <label>
                    <?php if (in_array($dservice['value'], $aramex_allowed_domestic_methods)) { ?>
                    <input type="checkbox" name="aramex_allowed_domestic_methods[]" value="<?php echo $dservice['value']; ?>" checked="checked" />
                    <?php echo $dservice['label']; ?>
                    <?php } else { ?>
                    <input type="checkbox" name="aramex_allowed_domestic_methods[]" value="<?php echo $dservice['value']; ?>" />
                    <?php echo $dservice['label']; ?>
                    <?php } ?>
                  </label>
                </div>
                <?php } ?>
              </div>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017
Commented:
Check this:
  <div class="form-group">
            <label class="col-sm-2 control-label">{{ entry_allowed_domestic_methods }}</label>
            <div class="col-sm-4">
              <div class="well well-sm" style="height: 150px; overflow: auto;">
                {% for key, dservice in allowed_domestic_methods %}
                <div class="checkbox">
                  <label>                   
                    {% if dservice.value in aramex_allowed_domestic_methods %}
                    <input type="checkbox" name="aramex_allowed_domestic_methods[]" value="{{ dservice.value}}" checked="checked" />
                    {{ dservice.label }}
                    {% endfor %}{% endif %} {% else %}
                    <input type="checkbox" name="aramex_allowed_domestic_methods[]" value="{{ dservice.value }}" />
                    {{ dservice.label }}

                  </label>
                </div>

              </div>

Open in new window

Hamdan ShafiqFull Stack PHP Developer

Author

Commented:
thanks for  Leonidas Dosas nice solution.
Hamdan ShafiqFull Stack PHP Developer

Author

Commented:
plz check the line.
{% if dservice.value in shipping_aramex_allowed_domestic_methods %}

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial