Пример #1
0
    /**
     * @param BlockInterface $block
     *
     * @return string
     */
    public function repeatScript(BlockInterface $block)
    {
        $deepCopy = new DeepCopy();
        /** @var BlockInterface|FieldInterface|RenderableInterface $childCopy */
        $childCopy = $deepCopy->copy($block->getRepeatObject());
        $childCopy->clear();
        $childCopy->setParent($block);
        /** @var BlockInterface|FieldInterface $child */
        $child = $block->child(0);
        $res = '<script>
$(document).ready(function(e){
    $("[' . $this->containerSelector() . ']").repeatContainer({
        containerSelector : \'[' . $this->containerSelector() . ']\',
        blockSelector : \'[' . $this->blockSelector() . ']\',
        actionsSelector : \'[' . $this->actionsBlockSelector() . '="' . $block->getName() . '"]\',
        addSelector : \'[' . $this->addActionSelector() . ']\',
        deleteSelector : \'[' . $this->deleteActionSelector() . ']\',
        dummyObject: \'' . $childCopy . '\',
        addButton: \'' . $this->addButton($block, false) . '\',
        deleteButton: \'' . $this->deleteButton($block, false) . '\',
        fullActionsBlock: \'' . $this->actions($child, false) . '\'
    });
});
</script>';
        return $res;
    }
Пример #2
0
 /**
  * @param FormInterface|BlockInterface|FieldInterface $object
  *
  * @return string
  */
 public function errorsStr($object)
 {
     $errorDelimiter = Config::get(['renderer', 'errors', 'delimiter']);
     $errorsStr = implode($errorDelimiter, $object->getErrors());
     return $errorsStr;
 }
Пример #3
0
 /**
  * @param FormInterface|BlockInterface|FieldInterface $object
  *
  * @return string
  */
 public function title($object)
 {
     return $object->getTitle();
 }
Пример #4
0
 /**
  * @param FormInterface|BlockInterface $object
  *
  * @return string
  */
 public function children($object)
 {
     return implode('', $object->children()->getAll());
 }
Пример #5
0
 /**
  * @param FieldInterface|BlockInterface $object
  *
  * @return string
  */
 public function name($object)
 {
     return $object->getParent()->getName();
 }