2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HumHub Tips

Last updated at Posted at 2018-02-13

概要

HumHubのTipsです。

関連

Module.phpで定義したプロパティを呼び出す方法

モジュールのModule.phpで定義したプロパティは、モデルの中で以下のように呼び出すことができます。

$minimumUsernameLengthを定義して呼び出してみる

モジュールのファイルで定義
protected/humhub/modules/user/Module.php

<?php
namespace humhub\modules\user;

use Yii;

/**
 * User Module
 */
class Module extends \humhub\components\Module
{
    /* snip */

    /**
     * @var int minimum username length
     * @since 1.2
     */
    public $minimumUsernameLength = 4;

モデルで呼び出す
protected/humhub/modules/user/models/User.php

$userModule = Yii::$app->getModule('user');
echo $userModule->minimumUsernameLength; // 4
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?