We would like to create/add our own icon set for Drupal 8.
It was mentioned in issue: https://www.drupal.org/node/2451191 that it can be done by creating a custom module in Drupal 7.

Could you please explain the process for Drupal 8 or direct us to the documentation for extending your module in Drupal 8?

Thank you.

Using:
Drupal 8-beta15
With standard profile

Comments

gceja created an issue. See original summary.

cbeier’s picture

The module use now the new plugin system from via annotations. For a better understanding, please read the appropriate documentation for the plugin system on drupal.org.

If your module is called "custom_iconset" (e.g. your directory structure looks like "/modules/custom_iconset" with a "custom_iconset.info.yml" file inside), you can place a new php file inside "src/Plugin/SocialMediaLinks/Iconset":

/modules/custom_iconset/src/Plugin/SocialMediaLinks/Iconset/MyIconset.php

In this case the new iconset is called "My Iconset".

Inside this file you can declare and implement your iconset:

/**
 * @file
 * Contains \Drupal\custom_iconset\Plugin\SocialMediaLinks\Iconset\MyIconset.
 */

namespace Drupal\custom_iconset\Plugin\SocialMediaLinks\Iconset;

use Drupal\social_media_links\IconsetBase;
use Drupal\social_media_links\IconsetInterface;

/**
 * Provides 'my_iconset' iconset.
 *
 * @Iconset(
 *   id = "my_iconset",
 *   name = "My iconset",
 * )
 */
class MyIconset extends IconsetBase implements IconsetInterface {

  public function getStyle() {
  }

  public function getIconPath($iconName, $style) {
  }
}

After that, please clear the drupal cache (also after a change inside the annotation comment block).

Please see also the implemented iconset inside the social_media_links module (inside the "src/Plugin/SocialMediaLinks/Iconset") directory. All shipped iconsets are also implemented via the plugin system.

cbeier’s picture

@gceja: Is your question answered now?

cbeier’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

thalles’s picture

Thanks!