class Container in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/dependency-injection/Container.php \Symfony\Component\DependencyInjection\Container
- 8 core/lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
- 8 core/lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container
- 8 vendor/symfony/dependency-injection/Tests/Fixtures/php/services1-1.php \Symfony\Component\DependencyInjection\Container
- 8 core/lib/Drupal/Core/Render/Element/Container.php \Drupal\Core\Render\Element\Container
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Render/Element/Container.php \Drupal\Core\Render\Element\Container
Provides a render element that wraps child elements in a container.
Surrounds child elements with a <div> and adds attributes such as classes or an HTML ID.
Usage example:
$form['needs_accommodation'] = array(
'#type' => 'checkbox',
'#title' => 'Need Special Accommodations?',
);
$form['accommodation'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => 'accommodation',
),
'#states' => array(
'invisible' => array(
'input[name="needs_accommodation"]' => array(
'checked' => FALSE,
),
),
),
);
$form['accommodation']['diet'] = array(
'#type' => 'textfield',
'#title' => t('Dietary Restrictions'),
);
Plugin annotation
@RenderElement("container");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
- class \Drupal\Core\Render\Element\RenderElement implements ElementInterface
- class \Drupal\Core\Render\Element\Container
- class \Drupal\Core\Render\Element\RenderElement implements ElementInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, StringTranslationTrait
Expanded class hierarchy of Container
5 string references to 'Container'
- field.field.taxonomy_term.forums.forum_container.yml in core/
modules/ forum/ config/ install/ field.field.taxonomy_term.forums.forum_container.yml - core/modules/forum/config/install/field.field.taxonomy_term.forums.forum_container.yml
- Kernel::getContainerBaseClass in vendor/
symfony/ http-kernel/ Kernel.php - Gets the container's base class.
- PhpDumper::dump in vendor/
symfony/ dependency-injection/ Dumper/ PhpDumper.php - Dumps the service container as a PHP class.
- PhpDumperTest::testDump in vendor/
symfony/ dependency-injection/ Tests/ Dumper/ PhpDumperTest.php - SearchExcerptTest::testSearchExcerptSimplified in core/
modules/ search/ src/ Tests/ SearchExcerptTest.php - Tests search_excerpt() with search keywords matching simplified words.
52 #type uses of Container
- AccountForm::form in core/
modules/ user/ src/ AccountForm.php - Gets the actual form array to be built.
- AccountSettingsForm::buildForm in core/
modules/ user/ src/ AccountSettingsForm.php - Form constructor.
- AggregatorController::buildPageList in core/
modules/ aggregator/ src/ Controller/ AggregatorController.php - Builds a listing of aggregator feed items.
- ArgumentPluginBase::buildOptionsForm in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Provide a form to edit options for this plugin.
- ArgumentPluginBase::processContainerRadios in core/
modules/ views/ src/ Plugin/ views/ argument/ ArgumentPluginBase.php - Custom form radios process function.
File
- core/
lib/ Drupal/ Core/ Render/ Element/ Container.php, line 46 - Contains \Drupal\Core\Render\Element\Container.
Namespace
Drupal\Core\Render\ElementView source
class Container extends RenderElement {
/**
* {@inheritdoc}
*/
public function getInfo() {
$class = get_class($this);
return array(
'#process' => array(
array(
$class,
'processGroup',
),
array(
$class,
'processContainer',
),
),
'#pre_render' => array(
array(
$class,
'preRenderGroup',
),
),
'#theme_wrappers' => array(
'container',
),
);
}
/**
* Processes a container element.
*
* @param array $element
* An associative array containing the properties and children of the
* container.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
* @param array $complete_form
* The complete form structure.
*
* @return array
* The processed element.
*/
public static function processContainer(&$element, FormStateInterface $form_state, &$complete_form) {
// Generate the ID of the element if it's not explicitly given.
if (!isset($element['#id'])) {
$element['#id'] = HtmlUtility::getUniqueId(implode('-', $element['#parents']) . '-wrapper');
}
return $element;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Container:: |
public | function |
Returns the element properties for this element. Overrides ElementInterface:: |
1 |
Container:: |
public static | function | Processes a container element. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 2 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 69 |
RenderElement:: |
public static | function | Adds Ajax information about an element to communicate with JavaScript. | |
RenderElement:: |
public static | function | Adds members of this group as actual elements for rendering. | |
RenderElement:: |
public static | function | Form element processing handler for the #ajax form property. | |
RenderElement:: |
public static | function | Arranges elements into groups. | |
RenderElement:: |
public static | function |
Sets a form element's class attribute. Overrides ElementInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |