/** * Create data provider * * @param string $elementName * @param array $data * @return bool|BlockInterface * @throws \Exception */ public function create($elementName, array $data = []) { if ('text' == $elementName) { $elementName = 'input'; } $block = $this->context->getLayout()->getBlock($elementName); if (!$block) { throw new \Exception('Can not find block of element ' . $elementName); } $newBlock = clone $block; $newBlock->addData($data); return $newBlock; }