<?php if ($field->isPartial()): ?>
  <?php include_partial('discount_phone/'.$name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?>
<?php elseif ($field->isComponent()): ?>
  <?php include_component('discount_phone', $name, array('form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?>
<?php else: ?>
  <div class="<?php echo $class ?><?php $form[$name]->hasError() and print ' errors' ?>">
    <div>
      <?php $opts = $form[$name]->getWidget()->getOptions(); ?>
      <?php if (key_exists('type', $opts) && $opts['type'] == 'checkbox'): ?>
        <div class="content"><label><?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes); ?><?php echo $label; ?></label></div>
      <?php else: ?>
        <span class="inline-label"><?php echo $form[$name]->renderLabel($label) ?></span>
        <div class="content">
          <?php echo $name == 'url' ? 'http://'.$this->context->getRequest()->getHost().'/ru/discount/' : ''; ?> <?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?><?php echo ($name == 'url' ? '/ ' : '') ?> <?php echo ( $name == 'url' && !$form->isNew() ? '<div style="margin-left: 10px !important;" class="pseudo_button lui_pseudo pseudo_button_file_wrapper only_root_button" >Скопировать в буфер обмена</div>' : ''); ?>
          <?php echo $form[$name]->renderError() ?>
          <?php if ($help): ?><span class="help"><?php echo __($help, array(), 'messages') ?></span><?php elseif ($help = $form[$name]->renderHelp()): ?><span class="help"><?php echo strip_tags($help, '<a><i>') ?></span><?php endif; ?>
        </div>
      <?php endif; ?>
    </div>
  </div>
<?php endif; ?>
<?php
if ($name == 'url') {
    ?>
    <script>
        $('.pseudo_button').on('click', function (e) {
            try {

            }
                document.execCommand('copy');
            } catch(err) {
                console.log('Can`t copy');
        })
    </script>
<?php
}
?>