<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 擴展關系行為 ### [](https://octobercms.com/docs/backend/relations#extend-relation-behavior)擴展關系行為 有時您可能希望修改默認關系行為,并且有幾種方法可以執行此操作。 * [擴展關系配置](https://octobercms.com/docs/backend/relations#extend-relation-config) * [擴展視圖小部件](https://octobercms.com/docs/backend/relations#extend-view-widget) * [擴展管理小部件](https://octobercms.com/docs/backend/relations#extend-manage-widget) * [擴展樞軸小部件](https://octobercms.com/docs/backend/relations#extend-pivot-widget) * [擴展過濾器小部件](https://octobercms.com/docs/backend/relations#extend-filter-widgets) * [擴展刷新結果](https://octobercms.com/docs/backend/relations#extend-refresh-results) ### [](https://octobercms.com/docs/backend/relations#extend-relation-config)擴展關系配置 提供了操縱關系配置的機會。以下示例可用于根據模型的屬性注入不同的columns.yaml文件。 ~~~ public function relationExtendConfig($config, $field, $model) { // Make sure the model and field matches those you want to manipulate if (!$model instanceof MyModel || $field != 'myField') return; // Show a different list for business customers if ($model->mode == 'b2b') { $config->view['list'] = '$/author/plugin_name/models/mymodel/b2b_columns.yaml'; } } ~~~ ### [](https://octobercms.com/docs/backend/relations#extend-view-widget)擴展視圖小部件 提供了操作視圖小部件的機會。 > **注意**:視圖小部件尚未完全初始化,因此并非所有公共方法都能按預期工作!有關更多信息,請閱讀[如何刪除列](https://octobercms.com/docs/backend/relations#remove-column)。 例如,您可能想基于模型的屬性切換showCheckboxes。 ~~~ public function relationExtendViewWidget($widget, $field, $model) { // Make sure the model and field matches those you want to manipulate if (!$model instanceof MyModel || $field != 'myField') return; if ($model->constant) { $widget->showCheckboxes = false; } } ~~~ #### [](https://octobercms.com/docs/backend/relations#remove-column)如何刪除列 由于窗口小部件尚未在運行時循環的這一點完成初始化,因此無法調用$ widget-> removeColumn()。[ListController文檔中](https://octobercms.com/docs/backend/lists#extend-list-columns)描述的addColumns()方法將按預期工作,但是要刪除列,我們需要偵聽RelationExtendViewWidget()方法中的“ list.extendColumns”事件。以下示例顯示如何刪除列: ~~~ public function relationExtendViewWidget($widget, $field, $model) { // Make sure the model and field matches those you want to manipulate if (!$model instanceof MyModel || $field != 'myField') return; // Will not work! $widget->removeColumn('my_column'); // This will work $widget->bindEvent('list.extendColumns', function () use($widget) { $widget->removeColumn('my_column'); }); } ~~~ ### [](https://octobercms.com/docs/backend/relations#extend-manage-widget)擴展管理小部件 提供了操作關系的管理小部件的機會。 ~~~ public function relationExtendManageWidget($widget, $field, $model) { // Make sure the field is the expected one if ($field != 'myField') return; // manipulate widget as needed } ~~~ ### [](https://octobercms.com/docs/backend/relations#extend-pivot-widget)擴展樞軸小部件 提供了操作關系的樞軸小部件的機會。 ~~~ public function relationExtendPivotWidget($widget, $field, $model) { // Make sure the field is the expected one if ($field != 'myField') return; // manipulate widget as needed } ~~~ ### [](https://octobercms.com/docs/backend/relations#extend-filter-widgets)擴展過濾器小部件 可以使用以下方法擴展兩個過濾器小部件,一種用于的查看模式,一種用于的管理模式`RelationController`。 ~~~ public function relationExtendViewFilterWidget($widget, $field, $model) { // Extends the view filter widget } public function relationExtendManageFilterWidget($widget, $field, $model) { // Extends the manage filter widget } ~~~ 有關如何在過濾器小部件中以編程方式添加或刪除范圍的示例,請參見“[后端”列表文檔](https://octobercms.com/docs/backend/lists#extend-filter-scopes)的“**擴展過濾器作用域”**部分。[](https://octobercms.com/docs/backend/lists#extend-filter-scopes) ### [](https://octobercms.com/docs/backend/relations#extend-refresh-results)擴展刷新結果 當管理窗口小部件進行更改時,視圖窗口小部件通常會刷新,可以在發生此過程時使用此方法注入其他容器。返回帶有額外值的數組以發送到瀏覽器,例如: ~~~ public function relationExtendRefreshResults($field) { // Make sure the field is the expected one if ($field != 'myField') return; return ['#myCounter' => 'Total records: 6']; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看