Skip to content
Snippets Groups Projects
Commit 6454696e authored by Joël Pittet's avatar Joël Pittet Committed by Amitai Burstein
Browse files

Resolve #3502649 "Resolve phpstan errors and add DDEV"

parent d2e668ef
Branches 8.x-1.x
No related tags found
No related merge requests found
Showing
with 662 additions and 58 deletions
......@@ -21,3 +21,6 @@ tejasa
Weitzman
weitzman
# Documentation
blackfire
xhprof
name: ddev-drupal-contrib
repository: ddev/ddev-drupal-contrib
version: 1.0.0-rc23
install_date: "2025-01-31T14:41:50+02:00"
project_files:
- commands/web/eslint
- commands/web/expand-composer-json
- commands/web/nightwatch
- commands/web/phpcbf
- commands/web/phpcs
- commands/web/phpstan
- commands/web/phpunit
- commands/web/poser
- commands/web/stylelint
- commands/web/symlink-project
- config.contrib.yaml
global_files: []
removal_actions: []
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run eslint inside the web container
## Usage: eslint [flags] [args]
## Example: "ddev eslint"
## ExecRaw: true
if "$DDEV_DOCROOT/core/node_modules/.bin/eslint" --version >/dev/null ; then
# Configure prettier
test -e .prettierrc.json || ln -s $DDEV_DOCROOT/core/.prettierrc.json .
test -e .prettierignore || echo '*.yml' > .prettierignore
# Change directory to the project root folder
cd "$DDEV_DOCROOT/modules/custom/${DDEV_SITENAME//-/_}" || exit
"$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/eslint" --config="../../../core/.eslintrc.passing.json" --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core --ext=.js,.yml . "$@"
else
echo "eslint is not available. You may need to 'ddev exec \"cd $DDEV_DOCROOT/core && yarn install\"'"
exit 1
fi
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Add Drupal core and other needed dependencies.
## Usage: expand-composer-json [flags] [PROJECT_NAME]
## Example: "ddev expand-composer-json ctools"
## ExecRaw: true
export _WEB_ROOT=$DDEV_DOCROOT
cd "$DDEV_COMPOSER_ROOT" || exit
curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/scripts/expand_composer_json.php
if [[ ! -f composer.json ]]; then
echo "{}" > composer.json
_ddev_drupal_contrib_empty_composer=true
fi
php expand_composer_json.php "$DDEV_SITENAME"
rm -f expand_composer_json.php
if [ "$_ddev_drupal_contrib_empty_composer" = true ]; then
rm -f composer.json
fi
#!/bin/bash
## Description: Install Drupal and enable the module
## Usage: install
## Example: "ddev install"
vendor/bin/drush site:install --yes
vendor/bin/drush pm:install og_ui --yes
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run nightwatch inside the web container
## Usage: nightwatch [flags] [args]
## Example: "ddev nightwatch"
## ExecRaw: true
yarn --cwd "$DDEV_DOCROOT/core" test:nightwatch "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/custom/" "$@"
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run phpcbf inside the web container
## Usage: phpcbf [flags] [args]
## Example: "ddev phpcbf" or "ddev phpcbf -n"
## ExecRaw: true
if ! command -v phpcbf >/dev/null; then
echo "phpcbf is not available. You may need to 'ddev composer install'"
exit 1
fi
test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist
phpcbf -s --report-full --report-summary --report-source $DDEV_DOCROOT/modules/custom "$@"
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run phpcs inside the web container
## Usage: phpcs [flags] [args]
## Example: "ddev phpcs" or "ddev phpcs -n"
## ExecRaw: true
if ! command -v phpcs >/dev/null; then
echo "phpcs is not available. You may need to 'ddev composer install'"
exit 1
fi
test -e phpcs.xml.dist || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpcs.xml.dist
phpcs -s --report-full --report-summary --report-source $DDEV_DOCROOT/modules/custom --ignore=*/.ddev/* "$@"
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run phpstan inside the web container
## Usage: phpstan [flags] [args]
## Example: "ddev phpstan" or "ddev phpstan -n"
## ExecRaw: true
if ! command -v phpstan >/dev/null; then
echo "phpstan is not available. You may need to 'ddev poser'"
exit 1
fi
test -e phpstan.neon || curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/assets/phpstan.neon
# See https://git.drupalcode.org/project/gitlab_templates/-/commit/a107b7f1f79af12e0b09f70be47b68e3f69b4504
sed -i 's/BASELINE_PLACEHOLDER/phpstan-baseline.neon/g' phpstan.neon
# Add an empty baseline file to ensure it exists.
test -e phpstan-baseline.neon || touch phpstan-baseline.neon
phpstan analyse $DDEV_DOCROOT/modules/custom "$@"
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run phpunit inside the web container
## Usage: phpunit [flags] [args]
## Example: "ddev phpunit" or "ddev phpunit --stop-on-failure"
## ExecRaw: true
if ! command -v phpunit >/dev/null; then
echo "phpunit is not available. You may need to 'ddev composer install'"
exit 1
fi
# CHECK for local config.
if [ -f "phpunit.xml" ]; then
# Defer to local config
phpunit "$@"
else
# Bootstrap Drupal tests and run all custom module tests.
phpunit --bootstrap $PWD/$DDEV_DOCROOT/core/tests/bootstrap.php $DDEV_DOCROOT/modules/custom "$@"
fi
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Expand composer.json and run composer install.
## Usage: poser [flags] [args]
## Example: "ddev poser"
## ExecRaw: true
export COMPOSER=composer.contrib.json
.ddev/commands/web/expand-composer-json "$DDEV_PROJECT_NAME"
composer install
# The -f flag suppresses errors if lock file does not exist.
rm -f composer.contrib.json composer.contrib.lock
touch $DDEV_DOCROOT/core/.env
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Run stylelint inside the web container
## Usage: stylelint [flags] [args]
## Example: "ddev stylelint"
## ExecRaw: true
if $DDEV_DOCROOT/core/node_modules/.bin/stylelint --version >/dev/null ; then
# Change directory to the project root folder
cd "$DDEV_DOCROOT/modules/custom/${DDEV_SITENAME//-/_}" || exit
"$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/node_modules/.bin/stylelint" --color --config "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/core/.stylelintrc.json" "./**/*.css" "$@"
else
echo "stylelint is not available. You may need to 'ddev exec \"cd $DDEV_DOCROOT/core && yarn install\"'"
exit 1
fi
#!/bin/bash
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
## Description: Symlink all root files/dirs into web.modules/custom/[PROJECT_NAME]
## Usage: symlink-project [flags] [args]
## Example: "ddev symlink-project"
## ExecRaw: true
export _WEB_ROOT=$DDEV_DOCROOT
#todo use more dynamic ref.
cd "$DDEV_COMPOSER_ROOT" || exit
curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/scripts/symlink_project.php
# Symlink name using underscores.
# @see https://www.drupal.org/docs/develop/creating-modules/naming-and-placing-your-drupal-module
php symlink_project.php "${DDEV_SITENAME//-/_}"
rm -f symlink_project.php
#ddev-generated
## Command provided by https://github.com/ddev/ddev-drupal-contrib
web_environment:
# To change the Drupal core version, see the README:
# https://github.com/ddev/ddev-drupal-contrib/blob/main/README.md#changing-the-drupal-core-version
- DRUPAL_CORE=^11
- SIMPLETEST_DB=mysql://db:db@db/db
- SIMPLETEST_BASE_URL=http://web
- BROWSERTEST_OUTPUT_DIRECTORY=/tmp
- BROWSERTEST_OUTPUT_BASE_URL=${DDEV_PRIMARY_URL}
hooks:
post-start:
- exec-host: |
if [[ -f vendor/autoload.php ]]; then
ddev symlink-project
else
exit 0
fi
name: og
type: drupal
docroot: web
php_version: "8.1"
webserver_type: nginx-fpm
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.11"
use_dns_when_possible: true
composer_version: "2"
web_environment: []
corepack_enable: true
# Key features of DDEV's config.yaml:
# name: <projectname> # Name of the project, automatically provides
# http://projectname.ddev.site and https://projectname.ddev.site
# type: <projecttype> # backdrop, cakephp, craftcms, drupal, drupal6, drupal7, drupal8, drupal9, drupal10, drupal11, laravel, magento, magento2, php, shopware6, silverstripe, symfony, typo3, wordpress
# See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more
# information on the different project types
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "8.3" # PHP version to use, "5.6" through "8.4"
# You can explicitly specify the webimage but this
# is not recommended, as the images are often closely tied to DDEV's' behavior,
# so this can break upgrades.
# webimage: <docker_image> # nginx/php docker image.
# database:
# type: <dbtype> # mysql, mariadb, postgres
# version: <version> # database version, like "10.11" or "8.0"
# MariaDB versions can be 5.5-10.8, 10.11, and 11.4.
# MySQL versions can be 5.5-8.0.
# PostgreSQL versions can be 9-17.
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
# xdebug_enabled: false # Set to true to enable Xdebug and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xdebug" to enable Xdebug and "ddev xdebug off" to disable it work better,
# as leaving Xdebug enabled all the time is a big performance hit.
# xhprof_enabled: false # Set to true to enable Xhprof and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xhprof" to enable Xhprof and "ddev xhprof off" to disable it work better,
# as leaving Xhprof enabled all the time is a big performance hit.
# webserver_type: nginx-fpm or apache-fpm
# timezone: Europe/Berlin
# If timezone is unset, DDEV will attempt to derive it from the host system timezone
# using the $TZ environment variable or the /etc/localtime symlink.
# This is the timezone used in the containers and by PHP;
# it can be set to any valid timezone,
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# For example Europe/Dublin or MST7MDT
# composer_root: <relative_path>
# Relative path to the Composer root directory from the project root. This is
# the directory which contains the composer.json and where all Composer related
# commands are executed.
# composer_version: "2"
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
# to use the latest major version available at the time your container is built.
# It is also possible to use each other Composer version channel. This includes:
# - 2.2 (latest Composer LTS version)
# - stable
# - preview
# - snapshot
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
# To reinstall Composer after the image was built, run "ddev debug rebuild".
# nodejs_version: "22"
# change from the default system Node.js version to any other version.
# See https://ddev.readthedocs.io/en/stable/users/configuration/config/#nodejs_version for more information
# and https://www.npmjs.com/package/n#specifying-nodejs-versions for the full documentation,
# Note that using of 'ddev nvm' is discouraged because "nodejs_version" is much easier to use,
# can specify any version, and is more robust than using 'nvm'.
# corepack_enable: false
# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm
# additional_hostnames:
# - somename
# - someothername
# would provide http and https URLs for "somename.ddev.site"
# and "someothername.ddev.site".
# additional_fqdns:
# - example.com
# - sub1.example.com
# would provide http and https URLs for "example.com" and "sub1.example.com"
# Please take care with this because it can cause great confusion.
# upload_dirs: "custom/upload/dir"
#
# upload_dirs:
# - custom/upload/dir
# - ../private
#
# would set the destination paths for ddev import-files to <docroot>/custom/upload/dir
# When Mutagen is enabled this path is bind-mounted so that all the files
# in the upload_dirs don't have to be synced into Mutagen.
# disable_upload_dirs_warning: false
# If true, turns off the normal warning that says
# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set"
# ddev_version_constraint: ""
# Example:
# ddev_version_constraint: ">= 1.22.4"
# This will enforce that the running ddev version is within this constraint.
# See https://github.com/Masterminds/semver#checking-version-constraints for
# supported constraint formats
# working_dir:
# web: /var/www/html
# db: /home
# would set the default working directory for the web and db services.
# These values specify the destination directory for ddev ssh and the
# directory in which commands passed into ddev exec are run.
# omit_containers: [db, ddev-ssh-agent]
# Currently only these containers are supported. Some containers can also be
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
# the "db" container, several standard features of DDEV that access the
# database container will be unusable. In the global configuration it is also
# possible to omit ddev-router, but not here.
# performance_mode: "global"
# DDEV offers performance optimization strategies to improve the filesystem
# performance depending on your host system. Should be configured globally.
#
# If set, will override the global config. Possible values are:
# - "global": uses the value from the global config.
# - "none": disables performance optimization for this project.
# - "mutagen": enables Mutagen for this project.
# - "nfs": enables NFS for this project.
#
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#nfs
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen
# fail_on_hook_fail: False
# Decide whether 'ddev start' should be interrupted by a failing hook
# host_https_port: "59002"
# The host port binding for https can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_webserver_port: "59001"
# The host port binding for the ddev-webserver can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_db_port: "59002"
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
# unless explicitly specified.
# mailpit_http_port: "8025"
# mailpit_https_port: "8026"
# The Mailpit ports can be changed from the default 8025 and 8026
# host_mailpit_port: "8025"
# The mailpit port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be bound directly to localhost if specified here.
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
# Extra Debian packages that are needed in the webimage can be added here
# dbimage_extra_packages: [telnet,netcat]
# Extra Debian packages that are needed in the dbimage can be added here
# use_dns_when_possible: true
# If the host has internet access and the domain configured can
# successfully be looked up, DNS will be used for hostname resolution
# instead of editing /etc/hosts
# Defaults to true
# project_tld: ddev.site
# The top-level domain used for project URLs
# The default "ddev.site" allows DNS lookup via a wildcard
# If you prefer you can change this to "ddev.local" to preserve
# pre-v1.9 behavior.
# ngrok_args: --basic-auth username:pass1234
# Provide extra flags to the "ngrok http" command, see
# https://ngrok.com/docs/ngrok-agent/config or run "ngrok http -h"
# disable_settings_management: false
# If true, DDEV will not create CMS-specific settings files like
# Drupal's settings.php/settings.ddev.php or TYPO3's additional.php
# In this case the user must provide all such settings.
# You can inject environment variables into the web container with:
# web_environment:
# - SOMEENV=somevalue
# - SOMEOTHERENV=someothervalue
# no_project_mount: false
# (Experimental) If true, DDEV will not mount the project into the web container;
# the user is responsible for mounting it manually or via a script.
# This is to enable experimentation with alternate file mounting strategies.
# For advanced users only!
# bind_all_interfaces: false
# If true, host ports will be bound on all network interfaces,
# not the localhost interface only. This means that ports
# will be available on the local network if the host firewall
# allows it.
# default_container_timeout: 120
# The default time that DDEV waits for all containers to become ready can be increased from
# the default 120. This helps in importing huge databases, for example.
#web_extra_exposed_ports:
#- name: nodejs
# container_port: 3000
# http_port: 2999
# https_port: 3000
#- name: something
# container_port: 4000
# https_port: 4000
# http_port: 3999
# Allows a set of extra ports to be exposed via ddev-router
# Fill in all three fields even if you don’t intend to use the https_port!
# If you don’t add https_port, then it defaults to 0 and ddev-router will fail to start.
#
# The port behavior on the ddev-webserver must be arranged separately, for example
# using web_extra_daemons.
# For example, with a web app on port 3000 inside the container, this config would
# expose that web app on https://<project>.ddev.site:9999 and http://<project>.ddev.site:9998
# web_extra_exposed_ports:
# - name: myapp
# container_port: 3000
# http_port: 9998
# https_port: 9999
#web_extra_daemons:
#- name: "http-1"
# command: "/var/www/html/node_modules/.bin/http-server -p 3000"
# directory: /var/www/html
#- name: "http-2"
# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000"
# directory: /var/www/html
# override_config: false
# By default, config.*.yaml files are *merged* into the configuration
# But this means that some things can't be overridden
# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge
# and you can't erase existing hooks or all environment variables.
# However, with "override_config: true" in a particular config.*.yaml file,
# 'use_dns_when_possible: false' can override the existing values, and
# hooks:
# post-start: []
# or
# web_environment: []
# or
# additional_hostnames: []
# can have their intended affect. 'override_config' affects only behavior of the
# config.*.yaml file it exists in.
# Many DDEV commands can be extended to run tasks before or after the
# DDEV command is executed, for example "post-start", "post-import-db",
# "pre-composer", "post-composer"
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
# information on the commands that can be extended and the tasks you can define
# for them. Example:
#hooks:
# post-import-db:
# - exec: drush sql:sanitize
# - exec: drush updatedb
# - exec: drush cache:rebuild
/recipes/
/vendor/
/web/
/.editorconfig
/.gitattributes
/.prettierignore
/.prettierrc.json
/phpstan.neon
/phpstan-baseline.neon
# Changelog
All notable changes to the Organic Groups project are documented on [drupal.org](https://www.drupal.org/project/og/releases) and on [github](https://www.drupal.org/project/og/releases).
# Contributing
If you like to contribute use [the github issue queue] to add issues and
pull requests.
## Drupal 8
If you want to help get OG released, please check the open issues for the
Drupal 8 version and the open pull requests, especially the ones that are
marked as alpha blockers.
- [open issues]
- [pull requests]
- [alpha blockers]
[the github issue queue]: https://github.com/gizra/og/issues
[open issues]: https://git.io/f47tz
[pull requests]: https://git.io/f47t5
[alpha blockers]: https://git.io/f47td
![Status](https://travis-ci.org/Gizra/og.svg?branch=8.x-1.x)
## DESCRIPTION
## Description
The Organic Groups module (also referred to as the 'og' module), provides users
the ability to create, manage, and delete their own 'groups' on a site.
Each group can have members, and maintains a group home page which individual
group members may post into. Posts can be sent to multiple groups (i.e. cross-
posted), and individual posts (referred as 'group content') may be shared with
members, or non-members where necessary.
Group membership can be open, closed or moderated.
group members may post into. Posts can be sent to multiple groups (i.e.,
cross-posted), and individual posts (referred as 'group content') may be shared
with members, or non-members where necessary. Group membership can be open,
closed or moderated.
## TERMS AND DEFINITIONS
## Terms and definitions
- GROUP: A single node which can have different content types and users
associated with it.
......@@ -25,6 +25,7 @@ Group membership can be open, closed or moderated.
- GROUP CONTEXT: Whenever an individual piece of content such as a node or a
user is viewed, the module attempts to determine if the content is associated
with a particular group.
The group context is later on used to determine which access rights the user
is granted. For example, in a particular group context the user can edit
nodes, but is only allowed to view the nodes in a different group context.
......@@ -36,15 +37,17 @@ Group membership can be open, closed or moderated.
a group or with a group content. This means that you can associate different
users (as group content) to a certain user (as a group).
## GROUP ARCHITECTURE
## Group architecture
At the lowest level the module associates content types with groups. Above this
level is the role and permissions layer, which operates at the group level.
The Organic Groups module leverages Drupal's core functionality, especially the
level is the role and permissions layer, which operates at the group level. The
Organic Groups module leverages Drupal's core functionality, especially the
field API. This means that a content type is associated with a group, by setting
the correct field value.
Users are also allowed to select the groups that will be associated with the
content from a list of groups, which they have authorization to view.
As is the case with Drupal itself, in Organic Groups different permissions can
be assigned to different user roles. This allows group members to perform a
different set of actions, in different group contexts.
......@@ -58,13 +61,13 @@ that is associated with a group, we do it via an entity reference field that
has the default storage. The only information that we hold is that a group
content is referencing a group.
However, when dealing with the user entity we recognize that we need to
special case it. It won't suffice to just hold the reference between the user
and the group content as it will be laking crucial information such as: the
state of the user's membership in the group (active, pending or blocked), the
time the membership was created, the user's OG role in the group, etc.
However, the user entity it's a special case. It won't suffice to just hold the
reference between the user and the group content as it will be laking crucial
information such as: the state of the user's membership in the group (active,
pending or blocked), the time the membership was created, the user's OG role in
the group, etc.
For this meta data we have the fieldable OgMembership entity, that is always
For this metadata we have the fieldable OgMembership entity, that is always
connecting between a user and a group. There cannot be an OgMembership entity
connecting two non-user entities.
......@@ -75,18 +78,19 @@ Creating such a relation is done for example in the following way:
$membership->save();
```
Notice how the relation of the user to the group also includes the OG
audience field name this association was done by. Like this we are able to
express different membership types such as the default membership that comes
out of the box, or a "premium membership" that can be for example expired
after a certain amount of time (the logic for the expired membership in the
example is out of the scope of OG core).
Notice how the relation of the user to the group also includes the OG audience
field name this association was done by. Like this we are able to express
different membership types such as the default membership that comes out of the
box, or a "premium membership" that can be for example expired after a certain
amount of time (the logic for the expired membership in the example is out of
the scope of OG core).
Having this field separation is what allows having multiple OG audience fields
attached to the user, where each group they are associated with may be a result
of different membership types.
Having this field separation is what allows having multiple OG audience
fields attached to the user, where each group they are associated with may be
a result of different membership types.
## Installation
## INSTALLATION DRUPAL 8.x
Note that the following guide is here to get you started. Names for content
types, groups and group content given here are suggestions and are given to
provide a quick way to get started with Organic groups.
......@@ -126,12 +130,12 @@ provide a quick way to get started with Organic groups.
11. In order to define default permissions for groups that are newly created or
to edit permissions on all existing groups, navigate to the Group
default permissions page. Important permissions in this page are the ones
under the administer section. These permissions are what enable group admins
to have granular control over their own group. This means, that if you as
the site admin, don't want to allow group admins to control who can edit
nodes in their own group, you need to uncheck those permissions.
under the administration section. These permissions are what enable group
admins to have granular control over their own group. This means, that if
you as the site admin, don't want to allow group admins to control who can
edit nodes in their own group, you need to uncheck those permissions.
## DEVELOPERS & SITE BUILDERS
## Developers & site builders
- Views integration: There are some default views that ship with the module.
Follow those views configuration in terms of best practice (e.g. adding a
......@@ -146,13 +150,13 @@ provide a quick way to get started with Organic groups.
groups and groups content.
- You may craft your own URLs to prepopulate the group-audience fields
(e.g. node/add/post?field_group_audience=1 to prepopulate reference to
node ID 1), using the "Entity reference prepopulate" module
node ID 1), using the "Entity reference pre-populate" module
http://drupal.org/project/entityreference_prepopulate
and configuring the correct settings in the field UI. Read more about
it in Entity reference prepopulate's README file.
Further more, when Entity reference prepopulate module is enabled the node
it in Entity reference pre-populate's README file.
Furthermore, when Entity reference pre-populate module is enabled the node
"create" permissions will be enabled even for non-members. In order to allow
a non member to create a node to a group they don't belong to, you should
a non-member to create a node to a group they don't belong to, you should
craft the URL in the same way. OG will recognize this situation and add the
group as a valid option under the "My groups" widget.
- When deleting groups, it is possible to delete orphan group-content, or move
......@@ -160,6 +164,112 @@ provide a quick way to get started with Organic groups.
"Use queue" option, and process it using for example:
drush queue-run og_membership_orphans
## Contributing
[DDEV](https://ddev.com), a Docker-based PHP development tool for a streamlined
and unified development process, is the recommended tool for contributing to the
module. The [DDEV Drupal Contrib](https://github.com/ddev/ddev-drupal-contrib)
addon makes it easy to develop a Drupal module by offering the tools to set up
and test the module.
### Install DDEV
* Install a Docker provider by following DDEV [Docker Installation](https://ddev.readthedocs.io/en/stable/users/install/docker-installation/)
instructions for your Operating System.
* [Install DDEV](https://ddev.readthedocs.io/en/stable/users/install/ddev-installation/),
use the documentation that best fits your OS.
* DDEV is used mostly via CLI commands. [Configure shell completion &
autocomplete](https://ddev.readthedocs.io/en/stable/users/install/shell-completion/)
according to your environment.
* Configure your IDE to take advantage of the DDEV features. This is a critical
step to be able to test and debug your module. Remember, the website runs
inside Docker, so pay attention to these configurations:
- [PhpStorm Setup](https://ddev.readthedocs.io/en/stable/users/install/phpstorm/)
- [Configure](https://ddev.readthedocs.io/en/stable/users/debugging-profiling/step-debugging/)
PhpStorm and VS Code for step debugging.
- Profiling with [xhprof](https://ddev.readthedocs.io/en/stable/users/debugging-profiling/xhprof-profiling/),
[Xdebug](https://ddev.readthedocs.io/en/stable/users/debugging-profiling/xdebug-profiling/)
and [Blackfire](https://ddev.readthedocs.io/en/stable/users/debugging-profiling/blackfire-profiling/).
### Checkout the module
Normally, you check out the code form an [issue fork](https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-drupal/creating-issue-forks):
```shell
git clone git@git.drupal.org:issue/og-[issue number].git
cd og-[issue number]
```
### Start DDEV
Inside the cloned project run:
```shell
ddev start
```
This command will fire up the Docker containers and add all configurations.
### Install dependencies
```shell
ddev poser
```
This will install the PHP dependencies. Note that this is a replacement for
Composer _install_ command that knows how to bundle together Drupal core and the
module. Read more about this command at
https://github.com/ddev/ddev-drupal-contrib?tab=readme-ov-file#commands
```shell
ddev symlink-project
```
This symlinks the module inside `web/modules/custom`. Read more about this
command at https://github.com/ddev/ddev-drupal-contrib?tab=readme-ov-file#commands.
Note that as soon as `vendor/autoload.php` has been generated, this command runs
automatically on every `ddev start`.
This command should also be run when adding new directories or files to the root
of the module.
```shell
ddev exec "cd web/core && yarn install"
```
Install Node dependencies. This is needed for the `ddev eslint` and `ddev
stylelint` commands.
### Install Drupal
```shell
ddev install
```
This will install Drupal and will enable the module.
### Changing the Drupal core version
* Create a file `.ddev/config.local.yaml`
* In the new config file, set the desired Drupal core version. E.g.,
```yaml
web_environment:
- DRUPAL_CORE=^10.3
```
* Run `ddev restart`
Note that this file is not under VCS control. Refer to the original
documentation: [Changing the Drupal core version](https://github.com/ddev/ddev-drupal-contrib/blob/main/README.md#changing-the-drupal-core-version)
### Run tests
* `ddev phpunit`: run PHPUnit tests
* `ddev phpcs`: run PHP coding standards checks
* `ddev phpcbf`: fix coding standards findings
* `ddev phpstan`: run PHP static analysis
* `ddev eslint`: Run ESLint on Javascript and YAML files.
* `ddev stylelint`: Run Stylelint on CSS files.
## API
```php
......
......@@ -25,12 +25,16 @@
],
"require-dev": {
"drupal/coder": "^8.3.16",
"drush/drush": "^12.5 || ^13.3",
"phpunit/phpunit": "^7 || ^8 || ^9 || ^10.5"
},
"minimum-stability": "RC",
"minimum-stability": "dev",
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": true,
"tbachert/spi": true
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment