Example #1
0
 /**
  * @return string
  */
 public function getType()
 {
     $types = $this->manager->getAvailableTypes();
     foreach ($types as $type) {
         if ($type->getType() == $this->type) {
             return $type->getTitle();
         }
     }
     return $this->type;
 }
 /**
  * @return string
  */
 public function getTypeTitle()
 {
     foreach ($this->widgetManager->getAvailableTypes() as $group => $types) {
         if (isset($types[$this->type])) {
             return $types[$this->type];
         }
     }
     return $this->type;
 }
 /**
  * @param WidgetManager $widgetManager
  * @param string        $type
  */
 public function getCreate(WidgetManager $widgetManager, $type = 'html')
 {
     $this->setTitle(trans($this->wrapNamespace('core.title.create')));
     $types = $widgetManager->getAvailableTypes()->map(function ($type) {
         return $type->toArray();
     })->groupBy('group')->map(function ($group) {
         return $group->pluck('title', 'type');
     })->toArray();
     $this->setContent('widgets.create', compact('types', 'type'));
 }