/** * {@inheritdoc} */ public function getQuestion() { if ($this->flag->isEnabled()) { return t('Disable flag @name?', array('@name' => $this->flag->label())); } return t('Enable flag @name?', array('@name' => $this->flag->label())); }
/** * Create a node type and a flag. */ public function doCreateFlag() { $edit = [ 'bundles[' . $this->nodeType . ']' => $this->nodeType, ]; $this->flag = $this->createFlagWithForm('node', $edit, 'reload'); // Check to see if the flag was created. $this->assertText(t('Flag @this_label has been added.', ['@this_label' => $this->flag->label()])); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->flaggingService->reset($this->flag); drupal_set_message($this->t('Flag %label was reset.', [ '%label' => $this->flag->label(), ])); $form_state->setRedirectUrl($this->getCancelUrl()); }
/** * Create a node type and flag. */ public function doCreateFlag() { $edit = [ 'bundles[' . $this->nodeType . ']' => $this->nodeType, 'flag_confirmation' => $this->flagConfirmMessage, 'flagging_edit_title' => $this->flagDetailsMessage, 'unflag_confirmation' => $this->unflagConfirmMessage, ]; $this->flag = $this->createFlagWithForm('node', $edit, 'field_entry'); // Check to see if the flag was created. $this->assertText(t('Flag @this_label has been added.', ['@this_label' => $this->flag->label()])); }