Create notification notification form

@param String $type
@return View
540936
public function create($type = null)
    {
        app('antares.asset')->container('antares/foundation::application')->add('ckeditor', '/packages/ckeditor/ckeditor.js', ['webpack_forms_basic']);
        return $this->presenter->create($this->repository->makeModel()->getModel(), $type);
    }
200179
protected function createNotification(string $title, string $message, string $type): array
    {
        if (!in_array($type, Notification::TYPES))
        {
            $allowed_types = implode(', ', Notification::TYPES);
            throw new InvalidArgumentException("Wrong notification \$type '{$type}'. Use only '{$allowed_types}' types.");
        }

        return [
            'title' => $title,
            'message' => $message,
            'type' => $type,
        ];
    }
582847
public function actionCreate($type)
    {
        $model = new ProductTypeMeta();
        $model->product_type = $type;

        if ($model->loadAll(request()->post())) {
            $model->product_type = $type;
            if ($model->saveAll()) {
                return $this->redirect(['update', 'id' => $model->id]);
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);
    }
1108699
public function display($type = 'jpeg')
    {
        $type = $this->getType($type);

        header('Content-Type: image/' . $type);

        if ($type === 'jpeg')
        {
            imageinterlace($this->newImage, true);
        }

        $imageFunc = 'image' . $type;
        $imageFunc($this->newImage);

        $this->destroyAll();

        return $this;
    }
1186228
public function enqueueMessage($msg, $type = 'message')
	{
		if ($this->messageStatus) {
			$event = new Event('onApplicationEnqueueMessage');
			$event->addArgument('message', $msg);
			$event->addArgument('type', $type);
			Factory::getDispatcher()->triggerEvent($event);
		}
	}
716321
public function actionIndex( $type ) {

		$settings	= $this->modelService->getMetaMapByMetaType( Yii::$app->core->site, $type );
		$fieldsMap	= FormUtil::fillFromModelMeta( "config-$type", CoreGlobal::TYPE_SYSTEM, $settings );
		$form		= new GenericForm( [ 'fields' => $fieldsMap ] );

		$htmlContent = $this->renderPartial( '@cmsgears/module-core/admin/views/settings/info', [
							'fieldsMap' => $fieldsMap,
							'type' => $type,
							'form' => $form
						]);

		return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $htmlContent );
	}
430971
protected function createDetection(string $path, $type = Detection::TYPE_VIRUS, $description = null): Detection
    {
        return new Detection($path, $type, $description);
    }
113731
public static function notice($slug, $type = null)
    {
        ob_start();
        self::template($slug, 'notice');

        $result = null;
        if ($type == null) {
            $result = ob_get_flush();
        } else {
            $result = array(
                'message' => ob_get_flush(),
                'type'    => $type,
            );
        }

        return $result;
    }
884053
public function create_error_message( $type = '' ) {
		global $pagenow;

		$update_pages   = [ 'update-core.php', 'plugins.php', 'themes.php' ];
		$settings_pages = [ 'settings.php', 'options-general.php' ];

		if (
			( ( ! isset( $_GET['page'] ) || 'github-updater' !== $_GET['page'] ) &&
			in_array( $pagenow, $settings_pages, true ) ) ||
			! in_array( $pagenow, array_merge( $update_pages, $settings_pages ), true )
		) {
			return false;
		}

		if ( is_admin() && ! static::is_doing_ajax() ) {
			switch ( $type ) {
				case is_wp_error( $type ):
					self::$error_message = $type->get_error_message();
					add_action(
						is_multisite() ? 'network_admin_notices' : 'admin_notices',
						[
							$this,
							'show_wp_error',
						]
					);
					break;
				case 'waiting':
					if ( ! apply_filters( 'github_updater_disable_wpcron', false ) ) {
						add_action( is_multisite() ? 'network_admin_notices' : 'admin_notices', [ $this, 'waiting' ] );
					}
					// no break.
				case 'git':
				default:
					add_action(
						is_multisite() ? 'network_admin_notices' : 'admin_notices',
						[
							$this,
							'show_403_error_message',
						]
					);
					add_action(
						is_multisite() ? 'network_admin_notices' : 'admin_notices',
						[
							$this,
							'show_401_error_message',
						]
					);
			}
		}

		return true;
	}
205999
public function notify($type = 'default')
    {
        if (isset($this->observers[$type])) {
            foreach ($this->observers[$type] as $obs) {
                $obs->update($this);
            }
        }
        return $this;
    }
1215864
private function addHtmlMessage($type, $html = null, $css_selector = null)
    {
        return $this->add($type, array(
            'value' => $html,
            'selector' => $css_selector,
        ));
    }
568462
public function getForm($eloquent, $type = null)
    {
        $classname     = $eloquent->classname;
        $model         = $eloquent->contents->first();
        $configuration = [
            'content'       => $model !== null ? $model->content : null,
            'title'         => $model !== null ? $model->title : '',
            'type'          => $eloquent->exists ? $eloquent->type->name : '',
            'form_name'     => $eloquent->name
        ];
        $notification  = app($classname ?: Notification::class);

        $fluent        = new Fluent(array_merge($configuration, array_except($eloquent->toArray(), ['type'])));
        if (!is_null($fluent->type) && $type) {
            $fluent->type = $type;
        }

        return $this->form($fluent, $notification);
    }
870726
public function getNotificationContents($type = null)
    {
        return NotificationContents::select(['title', 'id'])
                        ->whereHas('lang', function($query) {
                            $query->where('code', locale());
                        })
                        ->whereHas('notification', function($query) use($type) {
                            if (is_null($type)) {
                                $query->whereHas('type', function($subquery) {
                                    $subquery->whereIn('name', ['sms', 'email']);
                                });
                            } elseif (is_numeric($type)) {
                                $query->where('type_id', $type);
                            } elseif (is_string($type)) {
                                $query->whereHas('type', function($subquery) use($type) {
                                    $subquery->where('name', $type);
                                });
                            }
                        })->get();
    }
1075578
public function notification($string, $type = null)
    {
        if (is_null($type)) {
            $type = 'info';
        }

        Session::flash('notification', $string);
        Session::flash('notificationType', 'alert-'.$type);
    }
876613
public function add($msg, $type = 'info')
    {
        if (!isset($this->data['current'][$type]) || !is_array($this->data['current'][$type])) {
            $this->data['current'][$type] = [];
        }

        foreach ((array) $msg as $msg) {
            $this->data['current'][$type][] = $msg;
        }

        return $this;
    }
1209182
public function actionCreate($type = WarehouseVoucher::TYPE_IN_PUT)
    {
        $model = new WarehouseVoucher([
            'name'        => 'VOUCHER-' . date('Ymdhis'),
            'date'        => date('Y-m-d h:i:s'),
            'status'      => WarehouseVoucher::STATUS_UNPAID,
            'employee_id' => get_current_employee_id(),
            'is_locked'   => 0,
            'type'        => $type,
        ]);
        if ($model->loadAll(request()->post())) {
            if ($model->saveAll()) {
                set_flash_has_been_saved();

                return $this->redirect([
                    'update',
                    'id' => $model->id,
                ]);
            } else {
                set_flash_has_not_been_saved();
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);
    }
552580
public function getForm($type = null)
    {
        if (!isset($this->forms[$type])) {
            $form = $this->getManager()->newForm($type);

            $this->forms[$type] = $this->initForm($form);
        }

        return $this->forms[$type];
    }