本文整理汇总了PHP中Drupal\Core\Entity\EntityForm::actions方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityForm::actions方法的具体用法?PHP EntityForm::actions怎么用?PHP EntityForm::actions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityForm
的用法示例。
在下文中一共展示了EntityForm::actions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = t('Save bundle');
$actions['delete']['#value'] = t('Delete bundle');
return $actions;
}
示例2: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->t('Save contact type');
$actions['delete']['#title'] = $this->t('Delete contact type');
return $actions;
}
示例3: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
if ($this->entity->isNew()) {
$actions['submit']['#value'] = $this->t('Save and edit');
}
return $actions;
}
示例4: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
// Get the basic actions from the base class.
$actions = parent::actions($form, $form_state);
// Change the submit button text.
$actions['submit']['#value'] = $this->t('Save');
return $actions;
}
示例5: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->getConfirmText();
unset($actions['delete']);
// Prepare cancel link.
$actions['cancel'] = ConfirmFormHelper::buildCancelLink($this, $this->getRequest());
return $actions;
}
示例6: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$form = parent::actions($form, $form_state);
// We want to display the button only on add page.
if ($this->entity->isNew() && \Drupal::moduleHandler()->moduleExists('field_ui')) {
$form['submit']['#value'] = $this->t('Save and manage fields');
}
return $form;
}
示例7: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
if (\Drupal::moduleHandler()->moduleExists('field_ui') && $this->getEntity()->isNew()) {
$actions['save_continue'] = $actions['submit'];
$actions['save_continue']['#value'] = t('Save and manage fields');
$actions['save_continue']['#submit'][] = [$this, 'redirectToFieldUI'];
}
return $actions;
}
示例8: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
// If we are displaying the delete confirmation skip the regular actions.
if (!$form_state->get('confirm_delete')) {
$actions = parent::actions($form, $form_state);
// We cannot leverage the regular submit handler definition because we
// have button-specific ones here. Hence we need to explicitly set it for
// the submit action, otherwise it would be ignored.
if ($this->moduleHandler->moduleExists('content_translation')) {
array_unshift($actions['submit']['#submit'], 'content_translation_language_configuration_element_submit');
}
return $actions;
} else {
return array();
}
}
示例9: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->t('Save settings');
if (!$this->entity->isNew()) {
$target_entity_type = $this->entityManager->getDefinition($this->entity->getTargetEntityTypeId());
$route_parameters = ['field_config' => $this->entity->id()] + FieldUI::getRouteBundleParameter($target_entity_type, $this->entity->bundle);
$url = new Url('entity.field_config.' . $target_entity_type->id() . '_field_delete_form', $route_parameters);
if ($this->getRequest()->query->has('destination')) {
$query = $url->getOption('query');
$query['destination'] = $this->getRequest()->query->get('destination');
$url->setOption('query', $query);
}
$actions['delete'] = array('#type' => 'link', '#title' => $this->t('Delete'), '#url' => $url, '#access' => $this->entity->access('delete'), '#attributes' => array('class' => array('button', 'button--danger')));
}
return $actions;
}
示例10: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
/* @var $search_api_page \Drupal\search_api_page\SearchApiPageInterface */
$search_api_page = $this->entity;
if ($search_api_page->isNew()) {
$actions['submit']['#value'] = $this->t('Next');
}
$default_index = $search_api_page->getIndex();
if (!empty($default_index)) {
// Add an update button that shows up when changing the index.
$default_index_states_invisible = array('invisible' => array(':input[name="index"]' => array('value' => $default_index)));
$actions['update'] = $actions['submit'];
$actions['update']['#value'] = $this->t('Update');
$actions['update']['#states'] = $default_index_states_invisible;
// Hide the Save button when the index changes.
$default_index_states_visible = array('visible' => array(':input[name="index"]' => array('value' => $default_index)));
$actions['submit']['#states'] = $default_index_states_visible;
}
return $actions;
}
示例11: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, array &$form_state)
{
// If we are displaying the delete confirmation skip the regular actions.
if (empty($form_state['confirm_delete'])) {
$actions = parent::actions($form, $form_state);
// Add the language configuration submit handler. This is needed because
// the submit button has custom submit handlers.
if ($this->moduleHandler->moduleExists('language')) {
array_unshift($actions['submit']['#submit'], 'language_configuration_element_submit');
array_unshift($actions['submit']['#submit'], array($this, 'languageConfigurationSubmit'));
}
// We cannot leverage the regular submit handler definition because we
// have button-specific ones here. Hence we need to explicitly set it for
// the submit action, otherwise it would be ignored.
if ($this->moduleHandler->moduleExists('content_translation')) {
array_unshift($actions['submit']['#submit'], 'content_translation_language_configuration_element_submit');
}
return $actions;
} else {
return array();
}
}
示例12: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
// Change the submit button text.
$actions['submit']['#value'] = $this->t('Save');
$actions['submit']['#suffix'] = $this->l($this->t('Cancel'), $this->getCancelUrl());
return $actions;
}
示例13: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
// We don't have a "delete" action here.
unset($actions['delete']);
return $actions;
}
示例14: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->entity->isNew() ? $this->t('Add ball') : $this->t('Update ball');
return $actions;
}
示例15: actions
/**
* {@inheritdoc}
*/
protected function actions(array $form, FormStateInterface $form_state)
{
$actions = parent::actions($form, $form_state);
$actions['delete']['#access'] = FALSE;
return $actions;
}