Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function createEmotionElements($emotionsNames)
- {
- $emotions = [];
- foreach ($emotionsNames as $emotionsName)
- {
- $emotionInstaller = $this->container->get('shopware.emotion_component_installer');
- try {
- $emotions[$emotionsName] = $emotionInstaller->createOrUpdate(
- $this->getName(),
- 'REDACTED' . ucfirst($emotionsName),
- [
- 'name' => 'REDACTED ' . ucfirst($emotionsName),
- 'template' => "REDACTED_$emotionsName",
- 'cls' => "emotion-REDACTED-$emotionsName-element",
- 'description' => 'REDACTED ' . ucfirst($emotionsName),
- ]
- );
- // We don't need fields, but here are some example if you do need it at some point
- /**
- $emotions[$emotionsName]->createHiddenField([
- 'name' => 'api_key'
- ]);
- $emotions[$emotionsName]->createHiddenField([
- 'name' => 'store_id'
- ]);
- **/
- } catch (\Exception $e) {
- $emotions[$emotionsName] = null;
- }
- }
- //We don't need config here so far, but one day we might
- if($emotions['sidebar'] != null)
- {
- $sbe = $emotions['sidebar'];
- }
- if($emotions['tooltip'] != null)
- {
- $tte = $emotions['tooltip'];
- }
- if($emotions['widget'] != null)
- {
- $we = $emotions['widget'];
- }
- }
- $this->createEmotionElements([
- 'sidebar',
- 'tooltip',
- 'widget'
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement