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 ShafiqFull Stack PHP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leonidas DosasCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hamdan ShafiqFull Stack PHP DeveloperAuthor Commented:
thanks for  Leonidas Dosas nice solution.
0
Hamdan ShafiqFull Stack PHP DeveloperAuthor Commented:
plz check the line.
{% if dservice.value in shipping_aramex_allowed_domestic_methods %}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Twig

From novice to tech pro — start learning today.