本文整理汇总了PHP中drupal_set_message函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_set_message函数的具体用法?PHP drupal_set_message怎么用?PHP drupal_set_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_set_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
parent::submitForm($form, $form_state);
$this->entity->delete();
drupal_set_message(t('The custom name format %label has been deleted.', array('%label' => $this->entity->label())));
$form_state->setRedirectUrl($this->getCancelUrl());
}
示例2: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$settings = array('types' => $form_state->getValue('types'));
$this->currentBundle->setAssignmentSettings(self::METHOD_ID, $settings)->save();
$this->setRedirect($form_state);
drupal_set_message($this->t('Package assignment configuration saved.'));
}
示例3: rubik_preprocess_page
/**
* Preprocessor for theme('page').
*/
function rubik_preprocess_page(&$vars)
{
// Show a warning if base theme is not present.
if (!function_exists('tao_theme') && user_access('administer site configuration')) {
drupal_set_message(t('The Rubik theme requires the !tao base theme in order to work properly.', array('!tao' => l('Tao', 'http://code.developmentseed.org/tao'))), 'warning');
}
// Set a page icon class.
$vars['page_icon_class'] = ($item = menu_get_item()) ? implode(' ', _rubik_icon_classes($item['href'])) : '';
// Help pages. They really do need help.
if (strpos($_GET['q'], 'admin/help/') === 0 && isset($vars['page']['content']['system_main']['main']['#markup'])) {
$vars['page']['content']['system_main']['main']['#markup'] = theme('help_page', array('content' => $vars['page']['content']['system_main']['main']['#markup']));
}
// Clear out help text if empty.
if (empty($vars['help']) || !strip_tags($vars['help'])) {
$vars['help'] = '';
}
// Process local tasks. Only do this processing if the current theme is
// indeed Rubik. Subthemes must reimplement this call.
global $theme;
if ($theme === 'rubik') {
_rubik_local_tasks($vars);
}
// Overlay is enabled.
$vars['overlay'] = module_exists('overlay') && overlay_get_mode() === 'child';
}
示例4: edit
function edit() {
$form_state = array(
'display' => &$this->display,
'renderer' => &$this,
'content_types' => $this->cache->content_types,
'no_redirect' => TRUE,
'display_title' => !empty($this->cache->display_title),
'cache key' => $this->display->cache_key,
);
$output = drupal_build_form('panels_edit_display_form', $form_state);
if (empty($form_state['executed']) || !empty($form_state['clicked_button']['preview'])) {
return $output;
}
if (!empty($form_state['clicked_button']['#save-display'])) {
drupal_set_message(t('Panel content has been updated.'));
panels_save_display($this->display);
}
else {
drupal_set_message(t('Your changes have been discarded.'));
}
panels_cache_clear('display', $this->display->did);
return $this->display;
}
示例5: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$this->page->removeAccessCondition($this->accessCondition->getConfiguration()['uuid']);
$this->page->save();
drupal_set_message($this->t('The access condition %name has been removed.', ['%name' => $this->accessCondition->getPluginDefinition()['label']]));
$form_state->setRedirectUrl($this->getCancelUrl());
}
示例6: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$this->taxonomyTerm->delete();
drupal_set_message($this->t('The forum %label and all sub-forums have been deleted.', array('%label' => $this->taxonomyTerm->label())));
$this->logger('forum')->notice('forum: deleted %label and all its sub-forums.', array('%label' => $this->taxonomyTerm->label()));
$form_state->setRedirectUrl($this->getCancelUrl());
}
示例7: notificationForm_submit
function notificationForm_submit($form, $form_state)
{
global $user;
$params = drupal_get_query_parameters();
$OID = $params['OID'];
// generate the notification
$notification = getFields(array('dateTargeted', 'message'), $form_state['values']);
$notification = stripTags($notification);
// allow some tags
$notification['dateTargeted'] = dbDatePHP2SQL(strtotime($notification['dateTargeted']));
$notification['bttnTitle'] = 'View Outreach';
$notification['bttnLink'] = '?q=viewOutreach&OID=' . $OID;
$notification['OID'] = $OID;
$notification['TID'] = dbGetTeamForOutreach($OID);
$notification['dateCreated'] = dbDatePHP2SQL(time());
foreach ($form_state['values']['UID'] as $UID) {
if ($UID != null) {
$notification['UID'] = $UID;
$result = dbAddNotification($notification);
}
}
if ($result) {
drupal_set_message('Notification added!');
drupal_goto('manageNotifications', array('query' => array('OID' => $OID)));
} else {
drupal_set_message('There was an error.', 'error');
}
}
示例8: save
/**
* @see LTIToolProviderOutcomesResourceEntityControllerInterface::save
*/
public function save($entity)
{
$transaction = db_transaction();
try {
$entity->is_new = empty($enity->lti_tool_provider_outcomes_resource_id);
if (empty($entity->lti_tool_provider_outcomes_resource_timestamp_created)) {
$entity->lti_tool_provider_outcomes_resource_timestamp_created = REQUEST_TIME;
}
field_attach_presave('lti_tool_provider_outcomes_resource', $entity);
$primary_key = $entity->lti_tool_provider_outcomes_resource_id ? 'lti_tool_provider_outcomes_resource_id' : array();
if (empty($primary_key)) {
drupal_write_record('lti_tool_provider_outcomes_resource', $entity);
field_attach_insert('lti_tool_provider_outcomes_resource', $entity);
$op = 'insert';
} else {
drupal_write_record('lti_tool_provider_outcomes_resource', $entity, $primary_key);
$op = 'update';
}
$function = 'field_attach_' . $op;
$function('lti_tool_provider_outcomes_resource', $entity);
module_invoke_all('entity_' . $op, $entity, 'lti_tool_provider_outcomes_resource');
unset($entity->is_new);
db_ignore_slave();
return $entity;
} catch (Exception $e) {
$transaction->rollback();
drupal_set_message(t('%e', array('%e' => $entity->{$e})));
watchdog_exception('lti_tool_provider_outcomes_resource', $e, NULL, WATCHDOG_ERROR);
return FALSE;
}
}
示例9: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
$this->page->removeVariant($this->displayVariant->id());
$this->page->save();
drupal_set_message($this->t('The display variant %name has been removed.', ['%name' => $this->displayVariant->label()]));
$form_state->setRedirectUrl($this->getCancelUrl());
}
示例10: createImageObject
function createImageObject($obj_specimen_pid, $obj_jp2URL, $obj_rft_id, $obj_sourceURL, $obj_width, $obj_height, $obj_jpeg_datastream_url, $obj_label)
{
$this->pid = $this->getNextImagePid();
$this->specimen_pid = $obj_specimen_pid;
$this->jp2URL = $obj_jp2URL;
$this->rft_id = $obj_rft_id;
$this->sourceURL = $obj_sourceURL;
$this->width = $obj_width;
$this->height = $obj_height;
$this->jpeg_datastream_url = $obj_jpeg_datastream_url;
if ($obj_label != null && $obj_label != '') {
$this->label = $obj_label;
} else {
$this->label = $this->pid;
//We may use something other than the pid for the label eventually
}
//create relationships
$pid_base = 'image';
if ($this->startFOXML()) {
if (!$this->addImage_RELS_EXT_datastream()) {
echo 'Unable to addImage_RELS_EXT_datastream.<br>';
}
if (!$this->addDC_datastream()) {
echo 'Unable to addDC_datastream.<br>';
}
list($this->width, $this->height) = getimagesize($this->jp2URL);
if (!$this->addImageMetadata_datastream()) {
echo 'Unable to addImageMetadata_datastream.<br>';
}
if (!$this->addJPEG_datastream()) {
echo 'Unable to addJPEG_datastream.<br>';
}
try {
$foxml_file = str_replace(':', '_', $this->pid);
$foxml_file = '/var/www/drupal/sites/default/files/apiary_datastreams/' . $foxml_file . '.xml';
if (file_exists($foxml_file)) {
unlink($foxml_file);
}
$this->dom->save($foxml_file);
if ($object = ingest_object_from_FOXML($this->dom)) {
$this->msg = "{$this->pid} successfully created.";
include_once drupal_get_path('module', 'apiary_project') . '/workflow/include/search.php';
$search_instance = new search();
$search_instance->index($this->pid);
return true;
} else {
$this->msg = "Unable to ingest image FOXML dom document.";
return false;
}
} catch (exception $e) {
drupal_set_message(t('Error Ingesting Image Object! ') . $e->getMessage(), 'error');
watchdog(t("Fedora_Repository"), "Error Ingesting Image Object!" . $e->getMessage(), WATCHDOG_ERROR);
return false;
}
} else {
$this->msg = "Unable to start image FOXML file for create image object.";
return false;
}
return true;
}
示例11: submit
/**
* {@inheritdoc}
*/
public function submit(array $form, array &$form_state)
{
// Delete and set message
$this->entity->delete();
drupal_set_message($this->t('The siren mapper @label has been deleted', array('@label' => $this->entity->name)));
$form_state['redirect_route'] = $this->getCancelRoute();
}
示例12: fetch
public function fetch()
{
$this->query = $this->url . '?pid=' . $this->pid . '&noredirect=true&format=unixref&id=doi%3A' . $this->doi;
$request_options = array('method' => 'POST');
$result = drupal_http_request($this->query, $request_options);
if ($result->code != 200) {
drupal_set_message(t('HTTP error: !error when trying to contact crossref.org for XML input', array('!error' => $result->code)), 'error');
return;
}
if (empty($result->data)) {
drupal_set_message(t('Did not get any data from crossref.org'), 'error');
return;
}
$sxml = @simplexml_load_string($result->data);
if ($error = (string) $sxml->doi_record->crossref->error) {
drupal_set_message($error, 'error');
return;
}
$this->nodes = array();
$this->parser = drupal_xml_parser_create($result->data);
// use case-folding so we are sure to find the tag in
xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, FALSE);
xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, TRUE);
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, 'unixref_startElement', 'unixref_endElement');
xml_set_character_data_handler($this->parser, 'unixref_characterData');
if (!xml_parse($this->parser, $result->data)) {
drupal_set_message(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser)), 'error');
}
xml_parser_free($this->parser);
return $this->node;
}
示例13: save
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state)
{
$account = $this->entity;
$account->save();
$form_state->setValue('uid', $account->id());
drupal_set_message($this->t('The changes have been saved.'));
}
示例14: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state)
{
$_SESSION['dblog_overview_filter'] = array();
$this->connection->delete('watchdog')->execute();
drupal_set_message($this->t('Database log cleared.'));
$form_state['redirect_route'] = $this->getCancelRoute();
}
示例15: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
/* @var $entity \Drupal\quiz\Entity\Quiz */
/* @var $question \Drupal\quiz\Entity\Question */
/* @var $answer \Drupal\quiz\Entity\Answer */
/* @var $state \Drupal\quiz\Entity\UserQuizStatus */
$entity = $this->entity;
$questions = $entity->getQuestions();
$answerCount = 0;
$questionCount = 0;
$stateCount = 0;
foreach ($questions as $question) {
$answers = $question->getAnswers();
foreach ($answers as $answer) {
$answerCount++;
$answer->delete();
}
$questionCount++;
$question->delete();
}
$states = $entity->getStatuses();
foreach ($states as $state) {
$stateCount++;
$state->delete();
}
$this->entity->delete();
drupal_set_message($this->t('Deleted Quiz @label, @answers answers, @questions questions and @states quiz attempts.', ['@label' => $this->entity->label(), '@answers' => $answerCount, '@questions' => $questionCount, '@states' => $stateCount]));
$form_state->setRedirectUrl($this->getCancelUrl());
}