Esempio n. 1
0
 /**
  * @return void
  */
 public function _construct()
 {
     parent::_construct();
     $this->setTemplate('widget/dob.phtml');
 }
Esempio n. 2
0
 /**
  * Initialize block
  *
  * @return void
  */
 public function _construct()
 {
     parent::_construct();
     $this->setTemplate('Training_Orm::customer/widget/priority.phtml');
 }
 /**
  * Test '%s' and '%d' formats to verify that '%s' returns a string and '%d' returns a numeric
  * string when AbstractWidget::getFieldName() is invoked.
  *
  * @param string $format Field name format (e.g. '%s' or '%d')
  * @param string $fieldName The field name
  * @param string $expectedValue The value we expect from AbstractWidget::getFieldName
  * @param string $method The method to invoke on the result from getFieldName() should return true
  *
  * @dataProvider getFieldNameDataProvider
  */
 public function testGetFieldName($format, $fieldName, $expectedValue, $method)
 {
     $this->_block->setData(self::KEY_FIELD_NAME_FORMAT, $format);
     $this->assertTrue(call_user_func($method, $blockFieldName = $this->_block->getFieldName($fieldName)));
     $this->assertEquals($expectedValue, $blockFieldName);
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 protected function _getAttribute($attributeCode)
 {
     if ($this->getForceUseCustomerAttributes() || $this->getObject() instanceof CustomerInterface) {
         return parent::_getAttribute($attributeCode);
     }
     try {
         $attribute = $this->addressMetadata->getAttributeMetadata($attributeCode);
     } catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
         return null;
     }
     if ($this->getForceUseCustomerRequiredAttributes() && $attribute && !$attribute->isRequired()) {
         $customerAttribute = parent::_getAttribute($attributeCode);
         if ($customerAttribute && $customerAttribute->isRequired()) {
             $attribute = $customerAttribute;
         }
     }
     return $attribute;
 }