├── .gitattributes ├── .github └── workflows │ └── wpcom.yml ├── .gitignore ├── LICENSE ├── README.md ├── _playground ├── blueprint-github.json └── demo-content.xml ├── build ├── editor.asset.php ├── editor.css ├── index.asset.php ├── index.js ├── style.asset.php └── style.css ├── enable-linked-groups.php ├── package-lock.json ├── package.json ├── readme.txt ├── src ├── editor.scss ├── index.js └── index.scss └── webpack.config.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/workflows/wpcom.yml: -------------------------------------------------------------------------------- 1 | name: Deploy Plugin 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | workflow_dispatch: 8 | 9 | jobs: 10 | Deploy-Plugin: 11 | name: Deploy-Plugin 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@master 15 | 16 | - name: Setup Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '20' 20 | 21 | - name: Install Dependencies 22 | run: npm install 23 | 24 | - name: Build 25 | run: npm run build 26 | 27 | - name: Upload the artifact 28 | uses: actions/upload-artifact@v4 29 | with: 30 | name: wpcom 31 | path: | 32 | . 33 | !.DS_Store 34 | !.stylelintrc.json 35 | !.eslintrc 36 | !.git 37 | !.gitattributes 38 | !.github 39 | !.gitignore 40 | !README.md 41 | !composer.json 42 | !composer.lock 43 | !node_modules 44 | !vendor 45 | !package-lock.json 46 | !package.json 47 | !webpack.config.js 48 | !.travis.yml 49 | !phpcs.xml.dist 50 | !sass 51 | !style.css.map 52 | !yarn.lock 53 | !src/ 54 | !node_modules/ 55 | !_playground/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # It's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods. 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | logs 26 | *.log 27 | *.sql 28 | *.sqlite 29 | 30 | # OS generated files # 31 | ###################### 32 | .DS_Store 33 | .DS_Store? 34 | ._* 35 | .Spotlight-V100 36 | .Trashes 37 | ehthumbs.db 38 | Thumbs.db 39 | 40 | # NPM # 41 | ####### 42 | node_modules/ 43 | 44 | # Composer # 45 | ############ 46 | vendor/ 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Enable Linked Groups 2 | 3 | [![Playground Demo Link](https://img.shields.io/badge/Playground_Demo-v0.1.0-blue?logo=wordpress&logoColor=%23fff&labelColor=%233858e9&color=%233858e9)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/ndiego/enable-linked-groups/main/_playground/blueprint-github.json) 4 | 5 | Easily add links to Group blocks in WordPress. 6 | 7 | This example plugin serves to demonstrate how you can extend core WordPress blocks. Feel free to tweak, modify, and make it your own. 8 | -------------------------------------------------------------------------------- /_playground/blueprint-github.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://playground.wordpress.net/blueprint-schema.json", 3 | "landingPage": "/wp-admin/post.php?post=7&action=edit", 4 | "login": true, 5 | "features": { 6 | "networking": true 7 | }, 8 | "steps": [ 9 | { 10 | "step": "updateUserMeta", 11 | "meta": { 12 | "admin_color": "modern", 13 | "show_welcome_panel": 0 14 | }, 15 | "userId": 1 16 | }, 17 | { 18 | "step": "setSiteOptions", 19 | "options": { 20 | "blogname": "Enable Linked Groups" 21 | } 22 | }, 23 | { 24 | "step": "installPlugin", 25 | "pluginZipFile": { 26 | "resource": "url", 27 | "url": "https://github-proxy.com/proxy/?repo=ndiego/enable-linked-groups&branch=main" 28 | } 29 | }, 30 | { 31 | "step": "installTheme", 32 | "themeZipFile": { 33 | "resource": "wordpress.org/themes", 34 | "slug": "twentytwentyfour" 35 | } 36 | }, 37 | { 38 | "step": "importWxr", 39 | "file": { 40 | "resource": "url", 41 | "url": "https://raw.githubusercontent.com/ndiego/enable-linked-groups/main/_playground/demo-content.xml" 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /_playground/demo-content.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 27 | 28 | 29 | My WordPress Website 30 | https://playground.wordpress.net/scope:0.1313479475293886 31 | 32 | Sun, 23 Jun 2024 20:22:47 +0000 33 | en-US 34 | 1.2 35 | https://playground.wordpress.net/scope:0.1313479475293886 36 | https://playground.wordpress.net/scope:0.1313479475293886 37 | 38 | 1 39 | 40 | 41 | https://wordpress.org/?v=6.5.4 42 | 43 | 44 | <![CDATA[Sample Page]]> 45 | https://playground.wordpress.net/scope:0.1313479475293886/?page_id=2 46 | Mon, 10 Jun 2024 15:11:38 +0000 47 | 48 | http://127.0.0.1:9400/?page_id=2 49 | 50 | 51 |

This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:

52 | 53 | 54 | 55 |
56 |

Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)

57 |
58 | 59 | 60 | 61 |

...or something like this:

62 | 63 | 64 | 65 |
66 |

The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.

67 |
68 | 69 | 70 | 71 |

As a new WordPress user, you should go to your dashboard to delete this page and create new pages for your content. Have fun!

72 | ]]>
73 | 74 | 2 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 0 84 | 0 85 | 86 | 87 | 0 88 | 89 | 90 | 91 | 92 |
93 | 94 | <![CDATA[Privacy Policy]]> 95 | https://playground.wordpress.net/scope:0.1313479475293886/?page_id=3 96 | Mon, 10 Jun 2024 15:11:38 +0000 97 | 98 | http://127.0.0.1:9400/?page_id=3 99 | 100 | 101 |

Who we are

102 | 103 | 104 |

Suggested text: Our website address is: http://127.0.0.1:9400.

105 | 106 | 107 |

Comments

108 | 109 | 110 |

Suggested text: When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.

111 | 112 | 113 |

An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

114 | 115 | 116 |

Media

117 | 118 | 119 |

Suggested text: If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

120 | 121 | 122 |

Cookies

123 | 124 | 125 |

Suggested text: If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.

126 | 127 | 128 |

If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.

129 | 130 | 131 |

When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed.

132 | 133 | 134 |

If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

135 | 136 | 137 |

Embedded content from other websites

138 | 139 | 140 |

Suggested text: Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.

141 | 142 | 143 |

These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

144 | 145 | 146 |

Who we share your data with

147 | 148 | 149 |

Suggested text: If you request a password reset, your IP address will be included in the reset email.

150 | 151 | 152 |

How long we retain your data

153 | 154 | 155 |

Suggested text: If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.

156 | 157 | 158 |

For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

159 | 160 | 161 |

What rights you have over your data

162 | 163 | 164 |

Suggested text: If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

165 | 166 | 167 |

Where your data is sent

168 | 169 | 170 |

Suggested text: Visitor comments may be checked through an automated spam detection service.

171 | 172 | ]]>
173 | 174 | 3 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 0 184 | 0 185 | 186 | 187 | 0 188 | 189 | 190 | 191 | 192 |
193 | 194 | <![CDATA[Enable Linked Groups]]> 195 | https://playground.wordpress.net/scope:0.1313479475293886/?page_id=7 196 | Sun, 23 Jun 2024 20:22:11 +0000 197 | 198 | https://playground.wordpress.net/scope:0.1313479475293886/?page_id=7 199 | 200 | 201 |
202 |
203 |

Linked Group

204 |
205 | 206 | 207 | 208 |

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

209 | 210 | 211 | 212 |
213 | 214 |
215 |
216 | ]]>
217 | 218 | 7 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 0 228 | 0 229 | 230 | 231 | 0 232 |
233 |
234 |
235 | -------------------------------------------------------------------------------- /build/editor.asset.php: -------------------------------------------------------------------------------- 1 | array(), 'version' => '087de5d1ca3b89699bf9'); 2 | -------------------------------------------------------------------------------- /build/editor.css: -------------------------------------------------------------------------------- 1 | .enable-linked-groups__link-popover .components-popover__content{min-width:350px}.enable-linked-groups__link-popover .block-editor-link-control__field{margin:8px}.enable-linked-groups__link-popover .block-editor-link-control__search-item{padding:8px}.enable-linked-groups__link-popover-menu{border-top:1px solid #1e1e1e;padding:8px}.enable-linked-groups__link-popover-menu .components-button.has-icon{height:auto;padding-left:8px;padding-right:8px;text-align:left}.enable-linked-groups__link-popover-menu .components-button.has-icon>svg{margin-right:8px}.enable-linked-groups__link-popover-post-selected{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:16px;width:100%}.enable-linked-groups__link-popover-post-selected-label{align-items:center;display:flex;flex-direction:row;gap:8px}.enable-linked-groups__link-popover-post-selected-icon{align-items:center;background-color:#f0f0f0;border-radius:2px;display:flex;flex-shrink:0;height:32px;justify-content:center;position:relative;width:32px} 2 | -------------------------------------------------------------------------------- /build/index.asset.php: -------------------------------------------------------------------------------- 1 | array('react', 'wp-block-editor', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-primitives'), 'version' => '9780a1d6ec17daf33994'); 2 | -------------------------------------------------------------------------------- /build/index.js: -------------------------------------------------------------------------------- 1 | (()=>{var e={942:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e="",t=0;t{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.React;var t=n(942),r=n.n(t);const o=window.wp.i18n,i=window.wp.hooks,a=window.wp.blockEditor,l=window.wp.components,s=window.wp.primitives,c=(0,e.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(s.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})),p=(0,e.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(s.Path,{d:"M15.5 7.5h-7V9h7V7.5Zm-7 3.5h7v1.5h-7V11Zm7 3.5h-7V16h7v-1.5Z"}),(0,e.createElement)(s.Path,{d:"M17 4H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM7 5.5h10a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V6a.5.5 0 0 1 .5-.5Z"})),u=window.wp.element,d=(0,u.forwardRef)((function({icon:e,size:t=24,...n},r){return(0,u.cloneElement)(e,{width:t,height:t,...n,ref:r})})),m=(0,e.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(s.Path,{d:"M17.031 4.703 15.576 4l-1.56 3H14v.03l-2.324 4.47H9.5V13h1.396l-1.502 2.889h-.95a3.694 3.694 0 0 1 0-7.389H10V7H8.444a5.194 5.194 0 1 0 0 10.389h.17L7.5 19.53l1.416.719L15.049 8.5h.507a3.694 3.694 0 0 1 0 7.39H14v1.5h1.556a5.194 5.194 0 0 0 .273-10.383l1.202-2.304Z"}));(0,i.addFilter)("blocks.registerBlockType","enable-linked-groups/add-attributes",(function(e){return"core/group"!==e.name?e:{...e,attributes:{...e.attributes,href:{type:"string"},linkDestination:{type:"string"},linkTarget:{type:"string"}}}})),(0,i.addFilter)("editor.BlockEdit","enable-linked-groups/add-inspector-controls",(function(t){return n=>{if("core/group"!==n.name)return(0,e.createElement)(t,{...n});const[r,i]=(0,u.useState)(!1),[s,v]=(0,u.useState)(null),{attributes:k,setAttributes:g}=n,{href:w,linkDestination:f,linkTarget:h}=k;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,{...n}),(0,e.createElement)(a.BlockControls,{group:"block"},(0,e.createElement)(l.ToolbarButton,{ref:v,name:"link",icon:c,title:(0,o.__)("Link","enable-linked-groups"),onClick:()=>i(!0),isActive:!!w||"post"===f||r}),r&&(0,e.createElement)(l.Popover,{anchor:s,onClose:()=>i(!1),placement:"bottom",focusOnMount:!0,offset:12,className:"enable-linked-groups__link-popover",variant:"alternate"},"post"!==f&&(0,e.createElement)(a.__experimentalLinkControl,{value:{url:w,opensInNewTab:"_blank"===h},onChange:({url:e="",opensInNewTab:t})=>{g({href:e,linkDestination:e?"custom":void 0,linkTarget:t?"_blank":void 0})},onRemove:()=>g({href:void 0,linkDestination:void 0,linkTarget:void 0})}),!w&&!f&&(0,e.createElement)("div",{className:"enable-linked-groups__link-popover-menu"},(0,e.createElement)(l.MenuGroup,null,(0,e.createElement)(l.MenuItem,{icon:p,iconPosition:"left",info:(0,o.__)("Use when the Group is located in a Query block.","enable-linked-groups"),onClick:()=>g({linkDestination:"post"})},(0,o.__)("Link to current post","enable-linked-groups")))),"post"===f&&(0,e.createElement)("div",{className:"enable-linked-groups__link-popover-post-selected"},(0,e.createElement)("div",{className:"enable-linked-groups__link-popover-post-selected-label"},(0,e.createElement)("span",{className:"enable-linked-groups__link-popover-post-selected-icon"},(0,e.createElement)(d,{icon:p})),(0,o.__)("Linked to current post","enable-linked-groups")),(0,e.createElement)(l.Button,{icon:m,label:(0,o.__)("Remove link","enable-linked-groups"),onClick:()=>g({linkDestination:void 0})})))))}})),(0,i.addFilter)("editor.BlockListBlock","enable-linked-groups/add-classes",(function(t){return n=>{const{name:o,attributes:i}=n;if("core/group"!==o)return(0,e.createElement)(t,{...n});const a=r()(n?.className,{"is-linked":i?.href||"post"===i?.linkDestination});return(0,e.createElement)(t,{...n,className:a})}}))})()})(); -------------------------------------------------------------------------------- /build/style.asset.php: -------------------------------------------------------------------------------- 1 | array(), 'version' => 'f57059310534b5028b4a'); 2 | -------------------------------------------------------------------------------- /build/style.css: -------------------------------------------------------------------------------- 1 | .wp-block-group.is-linked{position:relative}.wp-block-group.is-linked:not(.block-editor-block-list__block)>:nth-child(2){margin-block-start:0}.wp-block-group.is-linked a.wp-block-group__link{bottom:0;height:100%;left:0;position:absolute;text-decoration:none!important;width:100%;z-index:3}.wp-block-group.is-linked .wp-block-button,.wp-block-group.is-linked a{position:relative;z-index:4} 2 | -------------------------------------------------------------------------------- /enable-linked-groups.php: -------------------------------------------------------------------------------- 1 | 'enable-linked-groups-block-styles', 60 | 'src' => plugin_dir_url( __FILE__ ) . 'build/style.css', 61 | 'ver' => wp_get_theme()->get( 'Version' ), 62 | 'path' => plugin_dir_path( __FILE__ ) . 'build/style.css', 63 | ) 64 | ); 65 | } 66 | add_action( 'init', 'enable_linked_groups_block_styles' ); 67 | 68 | /** 69 | * Render the linked group block on the frontend. 70 | * 71 | * @since 0.1.0 72 | * 73 | * @param string $block_content The block content about to be appended. 74 | * @param array $block The full block, including name and attributes. 75 | * @return string Modified block content. 76 | */ 77 | function enable_linked_groups_render_block_button( $block_content, $block ) { 78 | if ( ! isset( $block['attrs']['href'] ) && ! isset( $block['attrs']['linkDestination'] ) ) { 79 | return $block_content; 80 | } 81 | 82 | $href = $block['attrs']['href'] ?? ''; 83 | $link_destination = $block['attrs']['linkDestination'] ?? ''; 84 | $link_target = $block['attrs']['linkTarget'] ?? '_self'; 85 | $link_rel = '_blank' === $link_target ? 'noopener noreferrer' : 'follow'; 86 | 87 | $link = ''; 88 | 89 | if ( 'custom' === $link_destination && $href ) { 90 | $link = $href; 91 | } elseif ( 'post' === $link_destination ) { 92 | $link = get_permalink(); 93 | } 94 | 95 | if ( ! $link ) { 96 | return $block_content; 97 | } 98 | 99 | // Add the is-linked class to the group block. 100 | $p = new WP_HTML_Tag_Processor( $block_content ); 101 | if ( $p->next_tag() ) { 102 | $p->add_class( 'is-linked' ); 103 | } 104 | $block_content = $p->get_updated_html(); 105 | 106 | $link_markup = sprintf( 107 | '', 108 | esc_url( $link ), 109 | esc_attr( $link_target ), 110 | esc_attr( $link_rel ) 111 | ); 112 | 113 | // Insert the link markup after the opening tag. 114 | $block_content = preg_replace( 115 | '/^\s*<(\w+)([^>]*)>/m', 116 | '<$1$2>' . $link_markup, 117 | $block_content, 118 | 1 119 | ); 120 | 121 | return $block_content; 122 | } 123 | add_filter( 'render_block_core/group', 'enable_linked_groups_render_block_button', 10, 2 ); 124 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "enable-linked-groups", 3 | "version": "0.1.0", 4 | "description": "Easily add links to Group blocks.", 5 | "author": "Nick Diego", 6 | "license": "GPL-2.0-or-later", 7 | "repository": { 8 | "type": "git", 9 | "url": "git://github.com/ndiego/enable-linked-groups.git" 10 | }, 11 | "scripts": { 12 | "build": "wp-scripts build", 13 | "lint:css": "wp-scripts lint-style", 14 | "lint:js": "wp-scripts lint-js", 15 | "lint:js:src": "wp-scripts lint-js ./src", 16 | "lint:js:src:fix": "wp-scripts lint-js ./src --fix", 17 | "start": "wp-scripts start", 18 | "packages-update": "wp-scripts packages-update", 19 | "update-pot": "wp i18n make-pot . languages/enable-linked-groups.pot --exclude=src", 20 | "plugin-zip": "wp-scripts plugin-zip" 21 | }, 22 | "dependencies": { 23 | "classnames": "^2.3.2" 24 | }, 25 | "devDependencies": { 26 | "@wordpress/icons": "^9.35.0", 27 | "@wordpress/scripts": "^26.15.0", 28 | "webpack-remove-empty-scripts": "^0.8.4" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Enable Linked Groups === 2 | Contributors: ndiego 3 | Tags: group, link, card 4 | Requires at least: 6.3 5 | Tested up to: 6.4 6 | Requires PHP: 7.4 7 | Stable tag: 0.1.0 8 | License: GPL-2.0-or-later 9 | License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 | 11 | Easily add links to Group blocks. 12 | 13 | == Description == 14 | 15 | Easily add icons to Button blocks. 16 | -------------------------------------------------------------------------------- /src/editor.scss: -------------------------------------------------------------------------------- 1 | .enable-linked-groups__link-popover { 2 | .components-popover__content { 3 | min-width: 350px; 4 | } 5 | 6 | .block-editor-link-control__field { 7 | margin: 8px; 8 | } 9 | 10 | .block-editor-link-control__search-item { 11 | padding: 8px; 12 | } 13 | 14 | &-menu { 15 | border-top: 1px solid #1e1e1e; 16 | padding: 8px; 17 | 18 | .components-button.has-icon { 19 | height: auto; 20 | padding-left: 8px; 21 | padding-right: 8px; 22 | text-align: left; 23 | 24 | &>svg { 25 | margin-right: 8px; 26 | } 27 | } 28 | } 29 | 30 | &-post-selected { 31 | align-items: center; 32 | display: flex; 33 | flex-direction: row; 34 | justify-content: space-between; 35 | width: 100%; 36 | padding: 16px; 37 | 38 | &-label { 39 | align-items: center; 40 | display: flex; 41 | flex-direction: row; 42 | gap: 8px; 43 | } 44 | 45 | &-icon { 46 | background-color: #f0f0f0; 47 | border-radius: 2px; 48 | height: 32px; 49 | width: 32px; 50 | align-items: center; 51 | display: flex; 52 | flex-shrink: 0; 53 | justify-content: center; 54 | position: relative; 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * External dependencies 3 | */ 4 | import classnames from 'classnames'; 5 | 6 | /** 7 | * WordPress dependencies 8 | */ 9 | import { __ } from '@wordpress/i18n'; 10 | import { addFilter } from '@wordpress/hooks'; 11 | import { 12 | BlockControls, 13 | __experimentalLinkControl as LinkControl, // eslint-disable-line 14 | } from '@wordpress/block-editor'; 15 | import { 16 | Button, 17 | ToolbarButton, 18 | MenuGroup, 19 | MenuItem, 20 | Popover, 21 | } from '@wordpress/components'; 22 | import { link, linkOff, page, Icon } from '@wordpress/icons'; 23 | import { useState } from '@wordpress/element'; 24 | 25 | /** 26 | * Add the attributes needed for linked groups. 27 | * 28 | * @since 0.1.0 29 | * @param {Object} settings 30 | */ 31 | function addAttributes( settings ) { 32 | if ( 'core/group' !== settings.name ) { 33 | return settings; 34 | } 35 | 36 | // Add the link attributes. 37 | const linkAttributes = { 38 | href: { 39 | type: 'string', 40 | }, 41 | linkDestination: { 42 | type: 'string', 43 | }, 44 | linkTarget: { 45 | type: 'string', 46 | }, 47 | }; 48 | 49 | const newSettings = { 50 | ...settings, 51 | attributes: { 52 | ...settings.attributes, 53 | ...linkAttributes, 54 | }, 55 | }; 56 | 57 | return newSettings; 58 | } 59 | 60 | addFilter( 61 | 'blocks.registerBlockType', 62 | 'enable-linked-groups/add-attributes', 63 | addAttributes 64 | ); 65 | 66 | /** 67 | * Filter the BlockEdit object and add linked group inspector controls. 68 | * 69 | * @todo Fix the issue where the popover remains open when clicking another block. 70 | * 71 | * @since 0.1.0 72 | * @param {Object} BlockEdit 73 | */ 74 | function addInspectorControls( BlockEdit ) { 75 | return ( props ) => { 76 | if ( props.name !== 'core/group' ) { 77 | return ; 78 | } 79 | 80 | const [ isEditingURL, setIsEditingURL ] = useState( false ); 81 | const [ popoverAnchor, setPopoverAnchor ] = useState( null ); 82 | const { attributes, setAttributes } = props; 83 | const { href, linkDestination, linkTarget } = attributes; 84 | 85 | return ( 86 | <> 87 | 88 | 89 | setIsEditingURL( true ) } 95 | isActive={ 96 | !! href || 97 | linkDestination === 'post' || 98 | isEditingURL 99 | } 100 | /> 101 | { isEditingURL && ( 102 | setIsEditingURL( false ) } 105 | placement="bottom" 106 | focusOnMount={ true } 107 | offset={ 12 } 108 | className="enable-linked-groups__link-popover" 109 | variant="alternate" 110 | > 111 | { linkDestination !== 'post' && ( 112 | { 121 | setAttributes( { 122 | href: newURL, 123 | linkDestination: newURL 124 | ? 'custom' 125 | : undefined, 126 | linkTarget: opensInNewTab 127 | ? '_blank' 128 | : undefined, 129 | } ); 130 | } } 131 | onRemove={ () => 132 | setAttributes( { 133 | href: undefined, 134 | linkDestination: undefined, 135 | linkTarget: undefined, 136 | } ) 137 | } 138 | /> 139 | ) } 140 | { ! href && ! linkDestination && ( 141 |
142 | 143 | 151 | setAttributes( { 152 | linkDestination: 'post', 153 | } ) 154 | } 155 | > 156 | { __( 157 | 'Link to current post', 158 | 'enable-linked-groups' 159 | ) } 160 | 161 | 162 |
163 | ) } 164 | { linkDestination === 'post' && ( 165 |
166 |
167 | 168 | 169 | 170 | { __( 171 | 'Linked to current post', 172 | 'enable-linked-groups' 173 | ) } 174 |
175 |
188 | ) } 189 |
190 | ) } 191 |
192 | 193 | ); 194 | }; 195 | } 196 | 197 | addFilter( 198 | 'editor.BlockEdit', 199 | 'enable-linked-groups/add-inspector-controls', 200 | addInspectorControls 201 | ); 202 | 203 | /** 204 | * Add linked group classes in the Editor. 205 | * 206 | * @since 0.1.0 207 | * @param {Object} BlockListBlock 208 | */ 209 | function addClasses( BlockListBlock ) { 210 | return ( props ) => { 211 | const { name, attributes } = props; 212 | 213 | if ( 'core/group' !== name ) { 214 | return ; 215 | } 216 | 217 | const classes = classnames( props?.className, { 218 | 'is-linked': 219 | attributes?.href || attributes?.linkDestination === 'post', 220 | } ); 221 | 222 | return ; 223 | }; 224 | } 225 | 226 | addFilter( 227 | 'editor.BlockListBlock', 228 | 'enable-linked-groups/add-classes', 229 | addClasses 230 | ); 231 | -------------------------------------------------------------------------------- /src/index.scss: -------------------------------------------------------------------------------- 1 | .wp-block-group { 2 | &.is-linked { 3 | position: relative; 4 | 5 | // Ensure the first real element inside the group is not affected by the overlay. 6 | &:not(.block-editor-block-list__block) > :nth-child(2) { 7 | margin-block-start: 0; 8 | } 9 | 10 | // Ensure the overlay is above everything else. 11 | a.wp-block-group__link { 12 | position: absolute; 13 | bottom: 0; 14 | left: 0; 15 | width: 100%; 16 | height: 100%; 17 | z-index: 3; 18 | text-decoration: none !important; 19 | } 20 | 21 | // Ensure buttons and links are above the overlay. 22 | .wp-block-button, 23 | a { 24 | position: relative; 25 | z-index: 4; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * External dependencies 3 | */ 4 | const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' ); 5 | const path = require( 'path' ); 6 | const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); 7 | 8 | module.exports = { 9 | ...defaultConfig, 10 | 11 | entry: { 12 | 'index' : path.resolve( process.cwd(), 'src/index.js' ), 13 | 'editor' : path.resolve( process.cwd(), 'src/editor.scss' ), 14 | 'style': path.resolve( process.cwd(), 'src/index.scss' ), 15 | }, 16 | 17 | plugins: [ 18 | ...defaultConfig.plugins, 19 | new RemoveEmptyScriptsPlugin(), 20 | ], 21 | }; --------------------------------------------------------------------------------