Deduces the config schema ID prefix for configurable plugin types.

@param array $data
The array of data for the plugin type.
358916
protected function addConfigSchemaPrefix(&$data) {
    if (!is_subclass_of($data['plugin_interface'], \Drupal\Core\Field\PluginSettingsInterface::class)
      && !is_subclass_of($data['plugin_interface'], \Drupal\Component\Plugin\ConfigurablePluginInterface::class)
    ) {
      // Only look at configurable plugins, whose interface inherits from
      // ConfigurablePluginInterface.
      // (Field module uses the equivalent, deprecated PluginSettingsInterface.)
      return;
    }

    $service = \Drupal::service($data['service_id']);
    $plugin_definitions = $service->getDefinitions();
    $plugin_ids = array_keys($plugin_definitions);

    // Use the last piece of the service name to filter potential config schema
    // keys by. This is to prevent false positives from a plugin with the same
    // ID but of a different type. E.g., there is a config schema item
    // 'views.field.file_size' and a field.formatter plugin 'file_size'. By
    // expecting 'formatter' in config keys we filter this out.
    $service_pieces = explode('.', $data['service_id']);
    $last_service_piece = end($service_pieces);

    $typed_config_manager = \Drupal::service('config.typed');
    $config_schema_definitions = $typed_config_manager->getDefinitions();
    $config_schema_ids = array_keys($config_schema_definitions);

    $plugin_schema_roots = [];

    // Try to find a key for each plugin.
    foreach ($plugin_ids as $plugin_id) {
      // Get all schema IDs that end with the plugin ID.
      $candidate_schema_ids = preg_grep("@\.{$plugin_id}\$@", $config_schema_ids);

      // Further filter by the last piece of the plugin manager service ID.
      // E.g. for 'plugin.manager.field.formatter' we filter by 'formatter'.
      // Force a boundary before (rather than a '.'), as condition plugins have
      // schema of the form 'condition.plugin.request_path',
      // Don't force a '.' after, as filter plugins have schema of the form
      // 'filter_settings.filter_html'.
      $candidate_schema_ids = preg_grep("@\b{$last_service_piece}@", $candidate_schema_ids);

      if (count($candidate_schema_ids) != 1) {
        // Skip this plugin if we found no potential schema IDs, or if we found
        // more than one, so we don't deal with an ambiguous result.
        continue;
      }

      $plugin_schema_id = reset($candidate_schema_ids);

      // We are interested in the schema ID prefix, which we expect to find
      // before the plugin ID.
      $plugin_schema_root = preg_replace("@{$plugin_id}\$@", '', $plugin_schema_id);

      $plugin_schema_roots[] = $plugin_schema_root;
    }

    // We found no schema IDs for the plugins: nothing to do.
    if (empty($plugin_schema_roots)) {
      return;
    }

    // There's no common prefix: bail.
    if (count(array_unique($plugin_schema_roots)) != 1) {
      return;
    }

    $common_schema_prefix = reset($plugin_schema_roots);

    $data['config_schema_prefix'] = $common_schema_prefix;
  }
879201
protected function generateDataTypes(array $schema)
    {
        $directory = $this->getMappingDirectory('DataType');
        foreach ($schema['datatypes'] as $dataType => $data) {
            $this->generateDataType($dataType, $data, $directory);
        }
    }
593152
function name_data($data){
		if ($data=="tr_pid")
			return $this->config->relation_id["db_name"];
		if ($data=="tr_text")
			return $this->config->text[0]["db_name"];
		return $data;
	}
1049831
protected function preparePropertyDefinitionData(array $data)
    {
        $data[JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE] = PropertyType::cast(
            $data[JSONConstants::JSON_PROPERTY_TYPE_PROPERTY_TYPE]
        );

        if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE])) {
            $data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE]
                = (array) $data[JSONConstants::JSON_PROPERTY_TYPE_DEAULT_VALUE];
        }

        if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION])) {
            $data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION] = DateTimeResolution::cast(
                $data[JSONConstants::JSON_PROPERTY_TYPE_RESOLUTION]
            );
        }

        if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION])) {
            $data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION] = DecimalPrecision::cast(
                $data[JSONConstants::JSON_PROPERTY_TYPE_PRECISION]
            );
        }

        if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY])) {
            $data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY] = Cardinality::cast(
                $data[JSONConstants::JSON_PROPERTY_TYPE_CARDINALITY]
            );
        }

        if (isset($data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY])) {
            $data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY] = Updatability::cast(
                $data[JSONConstants::JSON_PROPERTY_TYPE_UPDATABILITY]
            );
        }

        return $data;
    }
995901
public static function listVarTypes(array $data)
    {
        $vars = [];

        foreach ($data as $key => $value) {
            if (is_object($value)) {
                $type = '\\' . get_class($value);
            } else {
                $type = gettype($value);
            }

            $vars[] = sprintf(' * @var  $%s  %s', $key, $type);
        }

        return static::renderDocblock(implode("\n", $vars));
    }
1311717
public function setData(array $data)
    {
        parent::setData($data);

        /** @deprecated */
        if (isset($data['string'])) {
            trigger_error(
                sprintf(
                    'Filter expression option "string" is deprecated in favour of "condition": %s',
                    $data['string']
                ),
                E_USER_DEPRECATED
            );
            $this->setCondition($data['string']);
        }

        /** @deprecated */
        if (isset($data['table_name'])) {
            trigger_error(
                sprintf(
                    'Filter expression option "table_name" is deprecated in favour of "table": %s',
                    $data['table_name']
                ),
                E_USER_DEPRECATED
            );
            $this->setTable($data['table_name']);
        }

        /** @deprecated */
        if (isset($data['val'])) {
            trigger_error(
                sprintf(
                    'Filter expression option "val" is deprecated in favour of "value": %s',
                    $data['val']
                ),
                E_USER_DEPRECATED
            );
            $this->setValue($data['val']);
        }

        /** @deprecated */
        if (isset($data['operand'])) {
            trigger_error(
                sprintf(
                    'Query expression option "operand" is deprecated in favour of "conjunction": %s',
                    $data['operand']
                ),
                E_USER_DEPRECATED
            );
            $this->setConjunction($data['operand']);
        }

        if (isset($data['table'])) {
            $this->setTable($data['table']);
        }

        if (isset($data['property'])) {
            $this->setProperty($data['property']);
        }

        if (isset($data['value'])) {
            $this->setValue($data['value']);
        }

        if (isset($data['function'])) {
            $this->setFunc($data['function']);
        }

        if (isset($data['func'])) {
            $this->setFunc($data['func']);
        }

        if (isset($data['operator'])) {
            $this->setOperator($data['operator']);
        }

        if (isset($data['conjunction'])) {
            $this->setConjunction($data['conjunction']);
        }

        if (isset($data['conditions'])) {
            $this->addFilters($data['conditions']);
        }

        if (isset($data['filters'])) {
            $this->addFilters($data['filters']);
        }

        return $this;
    }
1219730
protected function parseTypeAndId(array $data)
    {
        $idx  = $this->getArrayValue($data, DocumentInterface::KEYWORD_ID, null);
        $type = $this->getArrayValue($data, DocumentInterface::KEYWORD_TYPE, null);

        return [$type, $idx];
    }
850237
public function setIdPrefix(string $prefix = null)
    {
        foreach ((array)$this as $element) {
            if (is_object($element)) {
                $element->setIdPrefix($prefix);
            }
        }
    }
843369
public function importDataV1x(array $data)
    {
        $this->_packageXml = null;
        $this->_init();
        // Import simple data
        if (isset($data['name'])) {
            $this->setName($data['name']);
        }
        if (isset($data['summary'])) {
            $this->setSummary($data['summary']);
        }
        if (isset($data['description'])) {
            $this->setDescription($data['description']);
        }
        if (isset($data['channel'])) {
            $this->setChannel($this->convertChannelFromV1x($data['channel']));
        }
        if (isset($data['license'])) {
            if (is_array($data['license'])) {
                $this->setLicense($data['license']['_content'], $data['license']['attribs']['uri']);
            } else {
                $this->setLicense($data['license']);
            }
        }
        if (isset($data['version'])) {
            $this->setVersion($data['version']['release']);
        }
        if (isset($data['stability'])) {
            $this->setStability($data['stability']['release']);
        }
        if (isset($data['notes'])) {
            $this->setNotes($data['notes']);
        }
        if (isset($data['date'])) {
            $this->setDate($data['date']);
        }
        if (isset($data['time'])) {
            $this->setTime($data['time']);
        }

        // Import authors
        $authors = array();
        $authorRoles = array('lead', 'developer', 'contributor', 'helper');
        foreach ($authorRoles as $authorRole) {
            if (isset($data[$authorRole])) {
                $authorList = $data[$authorRole];
                if (!is_array($authorList) || isset($authorList['name'])) {
                    $authorList = array($authorList);
                }
                foreach ($authorList as $authorRawData) {
                    $author = array();
                    $author['name'] = $authorRawData['name'];
                    $author['user'] = $authorRawData['user'];
                    $author['email'] = $authorRawData['email'];
                    array_push($authors, $author);
                }
            }
        }
        $this->setAuthors($authors);

        // Import dependencies
        $packages = array();
        $extensions = array();
        if (isset($data['dependencies']) && is_array($data['dependencies'])) {
            $dependencySections = array('required', 'optional');
            $elementTypes = array('package', 'extension');
            foreach ($dependencySections as $dependencySection) {
                if (isset($data['dependencies'][$dependencySection])) {
                    // Handle required PHP version
                    if ($dependencySection == 'required' && isset($data['dependencies']['required']['php'])) {
                        $this->setDependencyPhpVersion($data['dependencies']['required']['php']['min'], $data['dependencies']['required']['php']['max']);
                    }
                    // Handle extensions
                    if (isset($data['dependencies'][$dependencySection]['extension'])) {
                        $extensionList = $data['dependencies'][$dependencySection]['extension'];
                        if (!is_array($extensionList) || isset($extensionList['name'])) {
                            $extensionList = array($extensionList);
                        }
                        foreach ($extensionList as $extensionRawData) {
                            $extension = array();
                            $extension['name'] = $extensionRawData['name'];
                            $extension['min_version'] = isset($extensionRawData['min']) ? $extensionRawData['min'] : null;
                            $extension['max_version'] = isset($extensionRawData['max']) ? $extensionRawData['max'] : null;
                            array_push($extensions, $extension);
                        }
                    }
                    // Handle packages
                    if (isset($data['dependencies'][$dependencySection]['package'])) {
                        $packageList = $data['dependencies'][$dependencySection]['package'];
                        if (!is_array($packageList) || isset($packageList['name'])) {
                            $packageList = array($packageList);
                        }
                        foreach ($packageList as $packageRawData) {
                            $package = array();
                            $package['name'] = $packageRawData['name'];
                            $package['channel'] = $this->convertChannelFromV1x($packageRawData['channel']);
                            $package['min_version'] = isset($packageRawData['min']) ? $packageRawData['min'] : null;
                            $package['max_version'] = isset($packageRawData['max']) ? $packageRawData['max'] : null;
                            array_push($packages, $package);
                        }
                    }
                }
            }
        }
        $this->setDependencyPackages($packages);
        $this->setDependencyPhpExtensions($extensions);

        // Import contents
        if (isset($data['contents']) && is_array($data['contents']) && is_array($data['contents']['dir'])) {
            // Handle files
            $root = $data['contents']['dir'];
            if (isset($data['contents']['dir']['file'])) {
                $fileList = $data['contents']['dir']['file'];
                if (!is_array($fileList) || isset($fileList['attribs'])) {
                    $fileList = array($fileList);
                }
                foreach ($fileList as $fileRawData) {
                    $targetName = $fileRawData['attribs']['role'];
                    $parentTargetNode = $this->_getNode('target', $this->_packageXml->contents, $targetName);
                    $filePath = $fileRawData['attribs']['name'];
                    $filePathParts = explode('/', $filePath);
                    $fileName = array_pop($filePathParts);
                    $parentDirNode = null;
                    if (!empty($filePathParts)) {
                        $parentDirNode = $parentTargetNode;
                        foreach ($filePathParts as $directoryName) {
                            $parentDirNode = $this->_getNode('dir', $parentDirNode, $directoryName);
                        }
                    } else {
                        $parentDirNode = $this->_getNode('dir', $parentTargetNode, '.');
                    }
                    $fileNode = $parentDirNode->addChild('file');
                    $fileNode->addAttribute('name', $fileName);
                    $fileNode->addAttribute('hash', $fileRawData['attribs']['md5sum']);
                }
            }
        }

        return $this;
    }
207491
public function selected( array $data )
    {
        if ( isset( $data['tags'] ) && is_string( $data['tags'] ) )
        {
            $data['tags'] = explode( static::TAG_SEPARATOR, $data['tags'] );
        }

        if ( isset( $data['tagIds'] ) && is_string( $data['tagIds'] ) )
        {
            $data['tagIds'] = explode( static::TAG_SEPARATOR, $data['tagIds'] );
        }

        if ( isset( $data['localeTags'] ) && is_string( $data['localeTags'] ) )
        {
            $data['localeTags'] = explode( static::TAG_SEPARATOR, $data['localeTags'] );
        }

        if ( isset( $data['proxyData'] ) && is_string( $data['proxyData'] ) )
        {
            $data['proxyData'] = $this->parseProxyData( $data['proxyData'] );
        }

        return parent::selected( $data );
    }
254330
protected function fill(array $data)
    {
        $this->isoCode = $data['iso_code'];
        $this->name = $data['name'];
        $this->symbol = $data['symbol'];
        $this->subunit = $data['subunit'];
        $this->symbolFirst = $data['symbol_first'];
        $this->htmlEntity = $data['html_entity'];
        $this->decimalMark = $data['decimal_mark'];
        $this->thousandsSeparator = $data['thousands_separator'];
        $this->isoNumeric = $data['iso_numeric'];

        if (array_key_exists('alternate_symbols', $data)) {
            $this->alternateSymbols = $data['alternate_symbols'];
        }

        if (array_key_exists('disambiguate_symbol', $data)) {
            $this->disambiguateSymbol = $data['disambiguate_symbol'];
        }
    }
841863
function name_data($data){
		if ($data == "gr_id") return $this->config->id["name"];
		$parts=explode("c",$data);
		if ($parts[0]=="" && ((string)intval($parts[1]))==$parts[1])
			if (sizeof($this->config->text)>intval($parts[1]))
				return $this->config->text[intval($parts[1])]["name"];
		return $data;
	}
118330
public function process_dds($data) {
        global $DB;

        $prefix = 'qtype_'.self::qtype_name();

        $data = (object)$data;
        $oldid = $data->id;

        // Detect if the question is created or mapped.
        $oldquestionid   = $this->get_old_parentid('question');
        $newquestionid   = $this->get_new_parentid('question');
        $questioncreated = $this->get_mappingid('question_created', $oldquestionid) ? true : false;

        // If the question has been created by restore
        // we need to create its qtype_ddmarker too.
        if ($questioncreated) {
            // Adjust some columns.
            $data->questionid = $newquestionid;
            // Insert record.
            $newitemid = $DB->insert_record($prefix, $data);
            // Create mapping (needed for decoding links).
            $this->set_mapping($prefix, $oldid, $newitemid);
        }
    }
358978
private function mustHaveTheKeyInThe(array $data): void
    {
        $mapping = $this;
        assert($mapping instanceof ExposesDataKey);
        if (!isset($data[$mapping->key()])) {
            throw MissingTheKey::inTheInput($data, $mapping, $mapping->key());
        }
    }
924167
public function getEventTypeName(array $data = [], array $options = []): ?string
    {
        if (empty($data['name'])) {
            return null;
        }

        $prefix = !empty($options['prefix']) ? $options['prefix'] : 'Config';
        $type = !empty($data['type']) ? $data['type'] : 'default';
        $delimiter = '::';

        $name = $prefix . $delimiter . $data['name'] . $delimiter . Inflector::camelize($type);

        return $name;
    }
1039868
static function decodeElementRawData(string $data): ?array
    {
        $data = json_decode($data, true);
        if (is_array($data) &&
                isset($data['id']) && is_string($data['id']) && strlen($data['id']) > 0 &&
                isset($data['type']) && is_string($data['type']) && strlen($data['type']) > 0 &&
                isset($data['data']) && is_array($data['data'])
        ) {
            return $data;
        }
        return null;
    }
791452
protected function _keySql($prefix, $data)
    {
        $columns = $data['columns'];
        if ($this->_driver->isAutoQuotingEnabled()) {
            $columns = array_map(
                [$this->_driver, 'quoteIdentifier'],
                $columns
            );
        }

        if ($data['type'] === TableSchema::CONSTRAINT_FOREIGN) {
            $keyName = $data['references'][0];
            if ($this->_driver->isAutoQuotingEnabled()) {
                $keyName = $this->_driver->quoteIdentifier($keyName);
            }
            return $prefix . sprintf(
                ' FOREIGN KEY (%s) REFERENCES %s (%s) ON DELETE %s',
                implode(', ', $columns),
                $keyName,
                $this->_convertConstraintColumns($data['references'][1]),
                $this->_foreignOnClause($data['delete'])
            );
        }
        return $prefix . ' (' . implode(', ', $columns) . ')';
    }