/**
  * Intercept core config form block getScopeLabel() method
  * to add additional override hints.
  *
  * @see Magento\Config\Block\System\Config\Form::getScopeLabel()
  * @param \Magento\Config\Block\System\Config\Form $form
  * @param callable $getScopeLabel
  * @param Field $field
  * @return Phrase
  */
 public function aroundGetScopeLabel(\Magento\Config\Block\System\Config\Form $form, \Closure $getScopeLabel, Field $field)
 {
     $currentScopeId = null;
     switch ($form->getScope()) {
         case 'websites':
             $currentScopeId = $form->getWebsiteCode();
             break;
         case 'stores':
             $currentScopeId = $form->getStoreCode();
             break;
     }
     $overriddenLevels = $this->helper->getOverriddenLevels($field->getPath(), $form->getScope(), $currentScopeId);
     /* @var $returnPhrase Phrase */
     $labelPhrase = $getScopeLabel($field);
     if (!empty($overriddenLevels)) {
         $scopeHintText = $labelPhrase . $this->helper->formatOverriddenScopes($form, $overriddenLevels);
         // create new phrase, now that constituent strings are translated individually
         $labelPhrase = new Phrase($scopeHintText, $labelPhrase->getArguments());
     }
     return $labelPhrase;
 }
Exemplo n.º 2
0
 /**
  * Get parameters, corresponding to placeholders in raw exception message
  *
  * @return array
  */
 public function getParameters()
 {
     return $this->phrase->getArguments();
 }
Exemplo n.º 3
0
 /**
  * Test get arguments
  *
  * @return void
  */
 public function testGetArguments()
 {
     $text = 'some text';
     $arguments = ['arg1', 'arg2'];
     $phrase1 = new Phrase($text);
     $phrase2 = new Phrase($text, $arguments);
     $this->assertEquals([], $phrase1->getArguments());
     $this->assertEquals($arguments, $phrase2->getArguments());
 }