Commit e35a4e2b authored by bojanz's avatar bojanz

Add missing variable hints to make PhpStorm happy.

parent 58b19a17
......@@ -59,7 +59,7 @@ class AddressFormatForm extends EntityForm {
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\address\Entity\AddressFormatInterface $adress_format **/
/** @var \Drupal\address\Entity\AddressFormatInterface $address_format **/
$address_format = $this->entity;
$country_code = $address_format->getCountryCode();
if ($country_code == 'ZZ') {
......
......@@ -47,6 +47,7 @@ class ZoneForm extends EntityForm {
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\address\Entity\ZoneInterface $zone */
$zone = $this->entity;
$user_input = $form_state->getUserInput();
......@@ -106,7 +107,8 @@ class ZoneForm extends EntityForm {
];
$index = 0;
foreach ($this->entity->getMembers() as $key => $member) {
/** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
foreach ($zone->getMembers() as $key => $member) {
$member_form = &$form['members'][$index];
$member_form['#attributes']['class'][] = 'draggable';
$member_form['#weight'] = isset($user_input['members'][$index]) ? $user_input['members'][$index]['weight'] : NULL;
......@@ -208,6 +210,7 @@ class ZoneForm extends EntityForm {
*/
public function addMemberSubmit(array $form, FormStateInterface $form_state) {
$plugin_id = $form_state->getValue('plugin');
/** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
$member = $this->memberManager->createInstance($plugin_id);
$this->entity->addMember($member);
$form_state->setRebuild();
......@@ -218,6 +221,7 @@ class ZoneForm extends EntityForm {
*/
public function removeMemberSubmit(array $form, FormStateInterface $form_state) {
$member_index = $form_state->getTriggeringElement()['#member_index'];
/** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
$member = $form['members'][$member_index]['form']['#member'];
$this->entity->removeMember($member);
$form_state->setRebuild();
......@@ -227,6 +231,7 @@ class ZoneForm extends EntityForm {
* Validation callback for the embedded zone member form.
*/
public function memberFormValidate($member_form, FormStateInterface $form_state) {
/** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
$member = $member_form['#member'];
$member_form_state = $this->buildMemberFormState($member_form['#parents'], $form_state);
$member->validateConfigurationForm($member_form, $member_form_state);
......@@ -242,6 +247,7 @@ class ZoneForm extends EntityForm {
foreach ($form_state->getValue(['members']) as $member_index => $values) {
$member_form = $form['members'][$member_index]['form'];
/** @var \Drupal\address\Plugin\ZoneMember\ZoneMemberInterface $member */
$member = $member_form['#member'];
$member_form_state = $this->buildMemberFormState($member_form['#parents'], $form_state);
$member->submitConfigurationForm($member_form, $member_form_state);
......
......@@ -194,6 +194,7 @@ class AddressDefaultFormatter extends FormatterBase implements ContainerFactoryP
* The new rendered element.
*/
public static function postRender($content, array $element) {
/** @var \Drupal\address\Entity\AddressFormatInterface $address_format */
$address_format = $element['address_format']['#value'];
$format_string = $address_format->getFormat();
// Add the country to the bottom or the top of the format string,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment