{"id":13411272,"url":"https://github.com/pgyf/yii2-contextmenu","last_synced_at":"2025-10-13T23:18:23.237Z","repository":{"id":36763112,"uuid":"41069793","full_name":"pgyf/yii2-contextmenu","owner":"pgyf","description":" yii2 Extended for bootstrap-contextmenu","archived":false,"fork":false,"pushed_at":"2019-07-19T15:21:56.000Z","size":202,"stargazers_count":24,"open_issues_count":2,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-10-03T14:54:13.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgyf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-20T02:02:18.000Z","updated_at":"2025-09-18T15:40:23.000Z","dependencies_parsed_at":"2022-09-07T23:21:00.274Z","dependency_job_id":null,"html_url":"https://github.com/pgyf/yii2-contextmenu","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/pgyf/yii2-contextmenu","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgyf%2Fyii2-contextmenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgyf%2Fyii2-contextmenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgyf%2Fyii2-contextmenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgyf%2Fyii2-contextmenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgyf","download_url":"https://codeload.github.com/pgyf/yii2-contextmenu/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgyf%2Fyii2-contextmenu/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017244,"owners_count":26086014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:12.570Z","updated_at":"2025-10-13T23:18:23.222Z","avatar_url":"https://github.com/pgyf.png","language":"PHP","funding_links":[],"categories":["Extension 扩展"],"sub_categories":[],"readme":"# yii2-contextmenu\nyii2 Extended for bootstrap-contextmenu\n===============================\nyii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu\n\nGird right - click operation, you can remove the operation column\n\n![Effect picture 1](https://github.com/liyunfang/wr/blob/master/images/yii2-contextmenu-1.png \"Effect picture 1\")  \n\n![Effect picture 2](https://github.com/liyunfang/wr/blob/master/images/yii2-contextmenu-2.png \"Effect picture 2\")  \n\n\n\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\n composer require --prefer-dist liyunfang/yii2-contextmenu\n```\n\nor add\n\n```\n\"liyunfang/yii2-contextmenu\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nRequirements\n------------\nThis extension require twitter-bootstrap\n\nUsage\n-----\n\nOnce the extension is installed, simply use it in your code by  :\n\nGridView options\n```php\n 'columns' =\u003e [\n    [\n        'class' =\u003e \\liyunfang\\contextmenu\\SerialColumn::className(),\n        'contextMenu' =\u003e true,\n        //'contextMenuAttribute' =\u003e 'id',\n        'template' =\u003e '{view} {update} \u003cli class=\"divider\"\u003e\u003c/li\u003e {story}', \n        'buttons' =\u003e [\n             'story' =\u003e function ($url, $model) {\n                 $title = Yii::t('app', 'Story');\n                 $label = '\u003cspan class=\"glyphicon glyphicon-film\"\u003e\u003c/span\u003e ' . $title;\n                 $url = \\Yii::$app-\u003egetUrlManager()-\u003ecreateUrl(['/user/story','id' =\u003e $model-\u003eid]);\n                 $options = ['tabindex' =\u003e '-1','title' =\u003e $title, 'data' =\u003e ['pjax' =\u003e '0' ,  'toggle' =\u003e 'tooltip']];\n                 return '\u003cli\u003e' . Html::a($label, $url, $options) . '\u003c/li\u003e' . PHP_EOL;\n              }\n         ],\n   ],\n    ....\n],\n'rowOptions' =\u003e function($model, $key, $index, $gird){\n     $contextMenuId = $gird-\u003ecolumns[0]-\u003econtextMenuId;\n     return ['data'=\u003e[ 'toggle' =\u003e 'context','target'=\u003e \"#\".$contextMenuId ]];\n },\n\n ```\n \n or use KartikSerialColumn,But this requires the installation of grid Kartik extension.\n Please see https://github.com/kartik-v/yii2-grid\n \n GridView options\n```php\n 'columns' =\u003e [\n    [\n        'class' =\u003e \\liyunfang\\contextmenu\\KartikSerialColumn::className(),\n        'contextMenu' =\u003e true,\n        //'contextMenuAttribute' =\u003e 'id',\n        //'template' =\u003e '{view} {update}', \n        'contentOptions'=\u003e['class'=\u003e'kartik-sheet-style'],\n        'headerOptions'=\u003e['class'=\u003e'kartik-sheet-style'],\n        'urlCreator' =\u003e function($action, $model, $key, $index) { \n                if('update' == $action){\n                    return \\Yii::$app-\u003egetUrlManager()-\u003ecreateUrl(['/user/index','id' =\u003e $model-\u003eid]);\n                }\n                if('view' == $action){\n                    return \\Yii::$app-\u003egetUrlManager()-\u003ecreateUrl(['/user/view','id' =\u003e $model-\u003eid]);\n                }\n                return '#'; \n        },\n   ],\n    ....\n],\n'rowOptions' =\u003e function($model, $key, $index, $gird){\n     $contextMenuId = $gird-\u003ecolumns[0]-\u003econtextMenuId;\n     return ['data'=\u003e[ 'toggle' =\u003e 'context','target'=\u003e \"#\".$contextMenuId ]];\n },\n\n ```\n\n\n该扩展为gird行右击菜单，可以省去操作列。\n提供了继承yii2 grid的SerialColumn 和 继承 Kartik gird的SerialColumn。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgyf%2Fyii2-contextmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgyf%2Fyii2-contextmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgyf%2Fyii2-contextmenu/lists"}