當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。