コード例 #1
0
ファイル: Extension.php プロジェクト: quetzyg/foundation
 /**
  * Form View Generator for Orchestra\Extension.
  *
  * @param  \Illuminate\Support\Fluent  $model
  * @param  string  $name
  *
  * @return \Orchestra\Contracts\Html\Form\Builder
  */
 public function configure($model, $name)
 {
     return $this->form->of("orchestra.extension: {$name}", function (FormGrid $form) use($model, $name) {
         $form->setup($this, "orchestra::extensions/{$name}/configure", $model);
         $handles = data_get($model, 'handles', $this->extension->option($name, 'handles'));
         $configurable = data_get($model, 'configurable', true);
         if (!is_null($handles) && $configurable !== false) {
             $form->fieldset(function (Fieldset $fieldset) use($handles) {
                 // We should only cater for custom URL handles for a route.
                 $fieldset->control('input:text', 'handles')->label(trans('orchestra/foundation::label.extensions.handles'))->value(str_replace(['{{domain}}', '{domain}'], '{domain}', $handles));
             });
         }
     });
 }
コード例 #2
0
ファイル: Processor.php プロジェクト: jitheshgopan/extension
 /**
  * Execute extension processing.
  *
  * @param  object  $listener
  * @param  string  $type
  * @param  \Illuminate\Support\Fluent  $extension
  * @param  \Closure  $callback
  *
  * @return mixed
  */
 protected function execute($listener, $type, Fluent $extension, Closure $callback)
 {
     $name = $extension->get('name');
     try {
         // Check if folder is writable via the web instance, this would
         // avoid issue running Orchestra Platform with debug as true where
         // creating/copying the directory would throw an ErrorException.
         if (!$this->factory->permission($name)) {
             throw new FilePermissionException("[{$name}] is not writable.");
         }
         call_user_func($callback, $this->factory, $name);
     } catch (FilePermissionException $e) {
         return call_user_func([$listener, "{$type}HasFailed"], $extension, ['error' => $e->getMessage()]);
     }
     return call_user_func([$listener, "{$type}HasSucceed"], $extension);
 }
コード例 #3
0
ファイル: Extension.php プロジェクト: stevebauman/foundation
 /**
  * Form View Generator for Orchestra\Extension.
  *
  * @param  \Illuminate\Support\Fluent  $model
  * @param  string  $name
  *
  * @return \Orchestra\Contracts\Html\Form\Builder
  */
 public function configure($model, $name)
 {
     return $this->form->of("orchestra.extension: {$name}", function (FormGrid $form) use($model, $name) {
         $form->setup($this, "orchestra::extensions/{$name}/configure", $model);
         $handles = data_get($model, 'handles', $this->extension->option($name, 'handles'));
         $configurable = data_get($model, 'configurable', true);
         $form->fieldset(function (Fieldset $fieldset) use($handles, $name, $configurable) {
             // We should only cater for custom URL handles for a route.
             if (!is_null($handles) && $configurable !== false) {
                 $fieldset->control('input:text', 'handles')->label(trans('orchestra/foundation::label.extensions.handles'))->value($handles);
             }
             $fieldset->control('input:text', 'migrate')->label(trans('orchestra/foundation::label.extensions.update'))->field(function () use($name) {
                 return app('html')->link(handles("orchestra::extensions/{$name}/update", ['csrf' => true]), trans('orchestra/foundation::label.extensions.actions.update'), ['class' => 'btn btn-info']);
             });
         });
     });
 }
コード例 #4
0
ファイル: Extension.php プロジェクト: azraai/foundation
 /**
  * Form View Generator for Orchestra\Extension.
  *
  * @param  \Illuminate\Support\Fluent  $model
  * @param  string  $name
  *
  * @return \Orchestra\Contracts\Html\Form\Builder
  */
 public function configure($model, $name)
 {
     return $this->form->of("orchestra.extension: {$name}", function (FormGrid $form) use($model, $name) {
         $form->setup($this, "orchestra::extensions/{$name}/configure", $model);
         $handles = data_get($model, 'handles', $this->extension->option($name, 'handles'));
         $configurable = data_get($model, 'configurable', true);
         $publishing = data_get($model, 'publishing', true);
         $form->fieldset(function (Fieldset $fieldset) use($handles, $name, $configurable, $publishing) {
             // We should only cater for custom URL handles for a route.
             if (!is_null($handles) && $configurable !== false) {
                 $fieldset->control('input:text', 'handles')->label(trans('orchestra/foundation::label.extensions.handles'))->value($handles);
             }
             if ($publishing === true) {
                 $fieldset->control('input:text', 'migrate')->label(trans('orchestra/foundation::label.extensions.update'))->field($this->getPublishingField($name));
             }
         });
     });
 }
コード例 #5
0
ファイル: Viewer.php プロジェクト: quetzyg/foundation
 /**
  * View all extension page.
  *
  * @param  \Orchestra\Contracts\Extension\Listener\Viewer $listener
  *
  * @return mixed
  */
 public function index(Listener $listener)
 {
     $data['extensions'] = $this->extension->detect();
     return $listener->showExtensions($data);
 }