Extension::serialize

public Extension::serialize()

Implements Serializable::serialize().

Serializes the Extension object in the most optimized way.

File

core/lib/Drupal/Core/Extension/Extension.php, line 163

Class

Extension
Defines an extension (file) object.

Namespace

Drupal\Core\Extension

Code

public function serialize() {
  // Don't serialize the app root, since this could change if the install is
  // moved.
  $data = array(
    'type' => $this->type,
    'pathname' => $this->pathname,
    'filename' => $this->filename,
  );

  // @todo ThemeHandler::listInfo(), ThemeHandler::rebuildThemeData(), and
  //   system_list() are adding custom properties to the Extension object.
  $info = new \ReflectionObject($this);
  foreach ($info->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
    $data[$property->getName()] = $property->getValue($this);
  }

  return serialize($data);
}
doc_Drupal
2016-10-29 09:09:39
Comments
Leave a Comment

Please login to continue.