示例#1
0
 /**
  * {@inheritdoc}
  */
 public function settingsSummary()
 {
     $settings = $this->getSettings();
     $field_settings = $this->getFieldSettings();
     $subfield_types = DoubleFieldItem::subfieldTypes();
     $summary = [];
     if ($settings['inline']) {
         $summary[] = t('Display as inline element');
     }
     foreach (['first', 'second'] as $subfield) {
         $subfield_type = $subfield_types[$field_settings['storage'][$subfield]['type']];
         $summary[] = new FormattableMarkup('<b>@subfield - @subfield_type</b>', ['@subfield' => $subfield == 'first' ? t('First subfield') : t('Second subfield'), '@subfield_type' => strtolower($subfield_type)]);
         $summary[] = t('Widget: %type', ['%type' => $settings[$subfield]['type']]);
         switch ($settings[$subfield]['type']) {
             case 'textfield':
                 $summary[] = t('Size: %size', ['%size' => $settings[$subfield]['size']]);
                 $summary[] = t('Placeholder: %placeholder', ['%placeholder' => $settings[$subfield]['placeholder']]);
                 break;
             case 'checkbox':
                 $summary[] = t('Label: %label', ['%label' => $settings[$subfield]['label']]);
                 break;
             case 'select':
                 break;
             case 'textarea':
                 $summary[] = t('Columns: %cols', ['%cols' => $settings[$subfield]['cols']]);
                 $summary[] = t('Rows: %rows', ['%rows' => $settings[$subfield]['rows']]);
                 $summary[] = t('Placeholder: %placeholder', ['%placeholder' => $settings[$subfield]['placeholder']]);
                 break;
         }
         $summary[] = t('Prefix: %prefix', ['%prefix' => $settings[$subfield]['prefix']]);
         $summary[] = t('Suffix: %suffix', ['%suffix' => $settings[$subfield]['suffix']]);
     }
     return $summary;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function settingsSummary()
 {
     $settings = $this->getSettings();
     $field_settings = $this->getFieldSettings();
     $subfield_types = DoubleFieldItem::subfieldTypes();
     foreach (['first', 'second'] as $subfield) {
         $subfield_type = $subfield_types[$field_settings['storage'][$subfield]['type']];
         $summary[] = new FormattableMarkup('<b>@subfield - @subfield_type</b>', ['@subfield' => $subfield == 'first' ? t('First subfield') : t('Second subfield'), '@subfield_type' => strtolower($subfield_type)]);
         $summary[] = t('Hidden: %value', ['%value' => $settings[$subfield]['hidden'] ? t('yes') : t('no')]);
         $summary[] = t('Prefix: %prefix', ['%prefix' => $settings[$subfield]['prefix']]);
         $summary[] = t('Suffix: %suffix', ['%suffix' => $settings[$subfield]['suffix']]);
     }
     return $summary;
 }