You are here

class ColorRed in Open Social 10.2.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_branding/src/Plugin/GraphQL/DataProducer/ColorRed.php \Drupal\social_branding\Plugin\GraphQL\DataProducer\ColorRed

The red component from color.

Plugin annotation


@DataProducer(
  id = "color_red",
  name = @Translation("Color red component"),
  description = @Translation("The color red component."),
  produces = @ContextDefinition("int",
    label = @Translation("Color red component")
  ),
  consumes = {
    "color" = @ContextDefinition("any",
      label = @Translation("Color"),
      required = TRUE
    )
  }
)

Hierarchy

  • class \Drupal\social_branding\Plugin\GraphQL\DataProducer\ColorRed extends \Drupal\social_graphql\Plugin\GraphQL\DataProducer\Entity\EntityDataProducerPluginBase

Expanded class hierarchy of ColorRed

File

modules/social_features/social_branding/src/Plugin/GraphQL/DataProducer/ColorRed.php, line 26

Namespace

Drupal\social_branding\Plugin\GraphQL\DataProducer
View source
class ColorRed extends EntityDataProducerPluginBase {

  /**
   * Returns the color red component.
   *
   * @param \Drupal\social_branding\Wrappers\Color $color
   *   The color.
   *
   * @return int
   *   The color red component.
   */
  public function resolve(Color $color) : int {
    return $color
      ->red();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ColorRed::resolve public function Returns the color red component.