class JsonldEncoder

Encodes JSON-LD data.

Simply respond to JSON-LD requests using the JSON encoder.

Hierarchy

Expanded class hierarchy of JsonldEncoder

File

drupal/core/modules/jsonld/lib/Drupal/jsonld/JsonldEncoder.php, line 18
Definition of Drupal\jsonld\JsonldEncoder.

Namespace

Drupal\jsonld
View source
class JsonldEncoder extends JsonEncoder implements EncoderInterface {

  /**
   * The formats that this Encoder supports.
   *
   * @var array
   */
  protected static $format = array(
    'jsonld',
    'drupal_jsonld',
  );

  /**
   * Check whether the request is for JSON-LD.
   *
   * @param string $format
   *   The short name of the format returned by ContentNegotiation.
   *
   * @return bool
   *   Returns TRUE if the encoder can handle the request.
   */
  public function supportsEncoding($format) {
    return in_array($format, static::$format);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
JsonEncoder::$decodingImpl protected property
JsonEncoder::$encodingImpl protected property
JsonEncoder::decode public function Decodes a string into PHP data Overrides DecoderInterface::decode
JsonEncoder::encode public function Encodes data into the given format Overrides EncoderInterface::encode
JsonEncoder::FORMAT constant
JsonEncoder::getLastDecodingError public function Returns the last decoding error (if any)
JsonEncoder::getLastEncodingError public function Returns the last encoding error (if any)
JsonEncoder::supportsDecoding public function Checks whether the serializer can decode from given format Overrides DecoderInterface::supportsDecoding
JsonEncoder::__construct public function
JsonldEncoder::$format protected static property The formats that this Encoder supports.
JsonldEncoder::supportsEncoding public function Check whether the request is for JSON-LD. Overrides JsonEncoder::supportsEncoding