/** * {@inheritdoc} */ public function getMetadata() { $metadata = parent::getMetadata(); $formView = $this->getForm()->createView(); $metadata['currencies'] = $formView->vars['currency_choices']; return $metadata; }
/** * {@inheritDoc} */ public function init($name, array $params) { $params[FilterUtility::FRONTEND_TYPE_KEY] = 'number'; $params[FilterUtility::FORM_OPTIONS_KEY] = isset($params[FilterUtility::FORM_OPTIONS_KEY]) ? $params[FilterUtility::FORM_OPTIONS_KEY] : []; $params[FilterUtility::FORM_OPTIONS_KEY]['data_type'] = NumberFilterType::DATA_DECIMAL; parent::init($name, $params); }
/** * {@inheritdoc} */ public function parseData($data) { $data = parent::parseData($data); if ($data && is_numeric($data['value'])) { $data['value'] /= 100; } return $data; }
/** * {@inheritdoc} */ public function getMetadata() { $attribute = $this->getAttribute(); $metadata = parent::getMetadata(); if (true === $attribute->isDecimalsAllowed()) { $metadata['formatterOptions']['decimals'] = 2; $metadata['formatterOptions']['grouping'] = true; } return $metadata; }
/** * {@inheritdoc} */ public function parseData($data) { if (!$this->isApplicable($data)) { return parent::parseData($data); } if (!is_array($data) || !array_key_exists('value', $data) && !array_key_exists('value_end', $data)) { return false; } if (!isset($data['value']) && !isset($data['value_end'])) { return false; } if (!isset($data['type'])) { $data['type'] = null; } $this->parseValue($data); return $data; }
/** * {@inheritdoc} */ public function getMetadata() { $metadata = parent::getMetadata(); $metadata['units'] = $this->measureManager->getUnitSymbolsForFamily($this->family); return $metadata; }
/** * @param FormFactoryInterface $factory * @param FilterUtility $util * @param CategoryRepositoryInterface $categoryRepo */ public function __construct(FormFactoryInterface $factory, FilterUtility $util, CategoryRepositoryInterface $categoryRepo) { parent::__construct($factory, $util); $this->categoryRepo = $categoryRepo; }
/** * Constructor * * @param FormFactoryInterface $factory * @param FilterUtility $util * @param ProductCategoryManager $manager */ public function __construct(FormFactoryInterface $factory, FilterUtility $util, ProductCategoryManager $manager) { parent::__construct($factory, $util); $this->manager = $manager; }
/** * @dataProvider parseDataProvider * * @param mixed $inputData * @param mixed $expectedData */ public function testParseData($inputData, $expectedData) { $this->assertEquals($expectedData, $this->filter->parseData($inputData)); }
/** * {@inheritdoc} */ public function getMetadata() { $metadata = parent::getMetadata(); $metadata['unitChoices'] = []; $unitChoices = $this->getForm()->createView()['unit']->vars['choices']; foreach ($unitChoices as $choice) { $metadata['unitChoices'][] = ['data' => $choice->data, 'value' => $choice->value, 'label' => $choice->label, 'shortLabel' => $this->formatter->format($choice->value, true)]; } return $metadata; }