当前位置: 首页>>代码示例>>PHP>>正文


PHP NestedArray::unsetValue方法代码示例

本文整理汇总了PHP中Drupal\Component\Utility\NestedArray::unsetValue方法的典型用法代码示例。如果您正苦于以下问题:PHP NestedArray::unsetValue方法的具体用法?PHP NestedArray::unsetValue怎么用?PHP NestedArray::unsetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Component\Utility\NestedArray的用法示例。


在下文中一共展示了NestedArray::unsetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clear

 /**
  * Unsets a value in this configuration object.
  *
  * @param string $key
  *   Name of the key whose value should be unset.
  *
  * @return $this
  *   The configuration object.
  */
 public function clear($key)
 {
     $parts = explode('.', $key);
     if (count($parts) == 1) {
         unset($this->data[$key]);
     } else {
         NestedArray::unsetValue($this->data, $parts);
     }
     return $this;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:19,代码来源:ConfigBase.php

示例2: removeDestinationProperty

 /**
  * Removes destination property.
  *
  * @param string $property
  *   The name of the destination property.
  */
 public function removeDestinationProperty($property)
 {
     unset($this->rawDestination[$property]);
     NestedArray::unsetValue($this->destination, explode(static::PROPERTY_SEPARATOR, $property));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:11,代码来源:Row.php

示例3: unsetValue

 /**
  * Implements \Drupal\Core\Form\FormStateInterface::unsetValue()
  */
 public function unsetValue($key)
 {
     NestedArray::unsetValue($this->getValues(), (array) $key);
     return $this;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:FormStateValuesTrait.php

示例4: setOverrideValue

 /**
  * Overrides the specified library asset.
  *
  * @param array $library
  *   The containing library definition.
  * @param array $sub_key
  *   An array containing the sub-keys specifying the library asset, e.g.
  *   @code['js']@endcode or @code['css', 'component']@endcode
  * @param array $overrides
  *   Specifies the overrides, this is an array where the key is the asset to
  *   be overridden while the value is overriding asset.
  */
 protected function setOverrideValue(array &$library, array $sub_key, array $overrides, $theme_path)
 {
     foreach ($overrides as $original => $replacement) {
         // Get the attributes of the asset to be overridden. If the key does
         // not exist, then throw an exception.
         $key_exists = NULL;
         $parents = array_merge($sub_key, [$original]);
         // Save the attributes of the library asset to be overridden.
         $attributes = NestedArray::getValue($library, $parents, $key_exists);
         if ($key_exists) {
             // Remove asset to be overridden.
             NestedArray::unsetValue($library, $parents);
             // No need to replace if FALSE is specified, since that is a removal.
             if ($replacement) {
                 // Ensure the replacement path is relative to drupal root.
                 $replacement = $this->resolveThemeAssetPath($theme_path, $replacement);
                 $new_parents = array_merge($sub_key, [$replacement]);
                 // Replace with an override if specified.
                 NestedArray::setValue($library, $new_parents, $attributes);
             }
         }
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:35,代码来源:LibraryDiscoveryParser.php

示例5: testUnsetValue

 /**
  * Tests unsetting nested array values.
  *
  * @covers ::unsetValue
  */
 public function testUnsetValue()
 {
     // Verify unsetting a non-existing nested element throws no errors and the
     // non-existing key is properly reported.
     $key_existed = NULL;
     $parents = $this->parents;
     $parents[] = 'foo';
     NestedArray::unsetValue($this->form, $parents, $key_existed);
     $this->assertTrue(isset($this->form['details']['element']['#value']), 'Outermost nested element key still exists.');
     $this->assertFalse($key_existed, 'Non-existing key not found.');
     // Verify unsetting a nested element.
     $key_existed = NULL;
     NestedArray::unsetValue($this->form, $this->parents, $key_existed);
     $this->assertFalse(isset($this->form['details']['element']), 'Removed nested element not found.');
     $this->assertTrue($key_existed, 'Existing key was found.');
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:21,代码来源:NestedArrayTest.php

示例6: clear

 public function clear($property)
 {
     NestedArray::unsetValue($this->data, $this->toKey($property));
     return $this;
 }
开发者ID:EclipseGc,项目名称:migrate_mini,代码行数:5,代码来源:ArrayWrapper.php


注:本文中的Drupal\Component\Utility\NestedArray::unsetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。