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

<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>
Hamdan ShafiqPHP Full Stack DeveloperAsked:
Who is Participating?
 
Leonidas DosasConnect With a Mentor 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

1
 
Hamdan ShafiqPHP Full Stack DeveloperAuthor Commented:
thanks for  Leonidas Dosas nice solution.
0
 
Hamdan ShafiqPHP Full Stack DeveloperAuthor Commented:
plz check the line.
{% if dservice.value in shipping_aramex_allowed_domestic_methods %}
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.