faithcatholic / custom_social
Provides custom social functionality such as sharing.
Package info
github.com/FaithCatholic/custom_social
Type:drupal-module
pkg:composer/faithcatholic/custom_social
Requires
None
Requires (Dev)
- drupal/devel: *
- drush/drush: *
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-11 22:24:09 UTC
README
Provides a single block, "Facebook share", that renders a Facebook share button
for whatever page it appears on. The block works out the absolute URL of the
current page, then outputs Facebook's standard fb-share-button markup wrapped
around a link to facebook.com/sharer/sharer.php for that URL. There is no
settings form, no route and no permission of its own. What it shares is decided
entirely by where you place the block and the visibility conditions you give it.
Requirements
Drupal 10.3+ or 11. The only dependency is core's Block module, which the standard profile already installs.
There are no contrib dependencies, and the module assumes nothing about your roles, content types, fields, views or media bundles. It works on a bare standard install.
To get Facebook's real button instead of a plain text link, the page also needs the Facebook JavaScript SDK. This module does not load it. See Notes below.
Installation
Install as usual at /admin/extend, or run drush en custom_social. Nothing else
has to exist on the site first.
Usage
- The module does nothing until you place the block. Go to /admin/structure/block, place "Facebook share" in a region, and save.
- Use the block's normal visibility conditions to limit it to the pages that should be shareable, such as specific content types or paths.
- The shared URL is the absolute URL of the page being viewed, using the path alias when the page has one. Query strings are not included.
- The block adds the
url.pathandurl.sitecache contexts, so it is cached per path and per scheme and host the site answers on. - No permissions are added. Anyone who can see the region sees the button.
Development
DDEV is configured for this repository. The module itself lives at the repo
root and is symlinked into web/modules/custom/custom_social. Both web/ and
vendor/ are gitignored and rebuilt locally.
ddev start runs the bootstrap in .ddev/post-start.sh: it runs ddev poser
to fetch core and dependencies, installs the site if the database is empty,
symlinks the project into the modules directory, enables devel and
custom_social, and prints a drush uli login link. The account is admin with
the password 1.
Checks:
ddev phpcsandddev phpcbffor coding standards.ddev phpstan --level=6 -c ../../../../phpstan.neonfor static analysis. Pass the config explicitly. Plainddev phpstanquietly ignores the repo config: the ddev-drupal-contrib add-on symlinksphpstan.neoninto the module directory using a relative path that does not resolve, so the run falls back to level 0 with none of the project settings.
Add-ons in use: ddev-drupal-contrib, ddev-drupal-contrib-extras, ddev-drupal and pimp-my-shell.
Notes
- The Facebook JavaScript SDK is not loaded by this module. Without it the
browser never turns the
fb-share-buttondiv into Facebook's widget, and visitors get a plain "Share" text link to the sharer dialog instead. The link itself works, it just does not look like a Facebook button. Load the SDK from your theme or another module if you want the widget. - The block plugin still uses the
@Blockannotation. Drupal 12 will require PHP attributes, so this has to become#[Block]before then. It is the only Drupal 12 item outstanding in this module. - The URL is built from the
<current>route, so the block expects a real page request. Rendering it from CLI or a queue worker, where there is no current route, would fail rather than fall back to something sensible. This is not reachable through normal page rendering.