public function formField() { if (class_exists('FontAwesomeIconPickerField') && static::$use_icon_picker) { $icon = \FontAwesomeIconPickerField::create('use', _t('Shortcodable.ICON', 'Icon')); $icon->addExtraClass('icp--css-icon-shortcode')->setAttribute('data-placement', 'bottomLeft'); if ($validIcons = HTMLEditorField::config()->valid_icon_shortcodes) { $icon->setAttribute('data-icons', json_encode(array_keys($validIcons))); } } else { if (HTMLEditorField::config()->valid_icon_shortcodes) { $icon = DropdownField::create('use', _t('Shortcodable.ICON', 'Icon'), Utilities::map_array_to_i18n(HTMLEditorField::config()->valid_icon_shortcodes, 'Icon')); } else { $icon = TextField::create('use', _t('Shortcodable.ICON', 'Icon')); } } if (HTMLEditorField::config()->prepend_icon) { $iconPrepend = ReadonlyField::create('prepend', _t('Shortcodable.ICON_PREPEND', 'Prepend'), HTMLEditorField::config()->prepend_icon); } else { $iconPrepend = TextField::create('prepend', _t('Shortcodable.ICON_PREPEND', 'Prepend'))->setAttribute('placeholder', static::$default_classes); } if (HTMLEditorField::config()->valid_icon_classes) { $iconClasses = DropdownField::create('classes', _t('Shortcodable.ICON_CLASSES', 'Classes'), array_combine(HTMLEditorField::config()->valid_icon_classes, HTMLEditorField::config()->valid_icon_classes)); } else { $iconClasses = TextField::create('classes', _t('Shortcodable.ICON_CLASSES', 'Classes')); } return CompositeField::create(FieldList::create($icon, $iconPrepend, $iconClasses)); }
public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.Main', array(FontAwesomeIconPickerField::create('FontAwesomeIcon', 'Font Awesome Icon'), TextField::create('TrackingID', 'Tracking ID')), 'OpenInNewWindow'); return $fields; }