texts: Error is raised when I try to redirect webform submission to external webpage with query string

texts:
Dear Drupal community,

I created a webform using the webforms module in Drupal 8 in order to add information to a webpage. Since I don't want to update the webpage manually I'd like to automatize this process by redirecting the information entered in the webform to a cgi script which then takes care of the rest (The target webpage is not based on drupal). So I used the [webform_submission:values:<>] tokens and added them in the query string of the external url. In principle it works, but I noticed that for some fields in the webform entries spaces and special characters like " and ' are possible. In these cases I get an error message that the confirmation URL is not valid. I attached a .png. At the blue line you see a space, this seems to be what causes the problem. But if I enter the url manually in the browser my cgi script works as expected. So I only need to prevent drupal from stopping the redirect.

I appreciate any help.

best regards

ps. I created the same post over at the drupal.org forum. Strangely though, I don't see my post appearing at the forum.

pps. While the approach with the query string is probably an unsafe approach it's alright for my purpose since everything happens in an password protected internal area.


texts:
I have a content type recipe and for each recipe type content I want to add a link which can download the recipe for the user.

How can this be done in Drupal 8.5.2?

I'm not sure if I should provide a field to attach the file or if it should be done in some other way like creating a template adding the values to it dynamically and then generating a PDF for the template and attaching a download link for it.


texts: Using a field in many content types? Usual or completely wrong?

texts:
A basic question: Is there anything wrong with using a defined field in many content types?
For example: body, image_field?
Are there any problems to be expected when I do this?
My guess is: No. No problems. But: is that right?


texts:
For weeks now I have been using collapsible fieldsets to display a particular node type field without problems. Sometime during the last week it inexplicably stopped working. Collapsible fieldsets still work correctly for core stuff (e.g. module listing) and the legend element appears as it used to, only the fieldset is collapsed (as it should be) and can't be expanded (the legend isn't clickable). Inspecting the HTML I can see that the value that should be in the fieldset is indeed there. What's extra curious is that in the Views GUI the fieldsets work correctly but not on the frontend of the same view.

Edit: I have been using collapsible fieldsets successfully outside of views on manually created content. This is the first time I try to use them in a view and it was how I discovered they'd ceased to function, both on the view I'm working on and the PHP code I've written myself. As per Laxman13's post, collapse.js is not being loaded on my own pages for some reason.


texts: How to get node id in a block_view theme page?

texts:
I have added blocks to my custom module. A same block should be displayed in two pages. I have to display the field
 $node->field_tag['und']['0']['value'];
in my block.

$nid = explode("/", $_GET['q']);
$node = node_load($nid[1]);

I got the node id by this. When it goes to another url it is not loading.
So how can I get the nid in the block_view theme page without using the url?


texts: Custom module template override not loaded

texts:
Hi I am desperetly trying to override the template of my D7 custom module's block here is my code :

  function lnr_block_info() {
    $menus = menu_get_menus();
    $blocks['actualites_filter_article'] = array(
      'info' => t('Actualités: Filtres Articles'),
    );

    return $blocks;
  }

  function lnr_block_view($delta = '') {
    $block = array();
    $menus = menu_get_menus();

    if($delta == 'actualites_filter_article'){
      $block['content'] = theme('actualite_filter_article');
    }

    return $block;
  }

  function lnr_theme() {
    $module_path = drupal_get_path('module', 'lnr');

    return array(
      'actualite_filter_article' => array(
        'variables' => array('result' => NULL),
        'path' => $module_path. '/templates',
        'template' => 'actualite-filter-article',
        //leave off .tpl.php
      ),
    );
  }

The template of the module is loaded correctly, but once I copy paste it in the theme templates directory it is not overriden. (the name of the template file is : actualite-filter-article.tpl.php ). What aam i doing wrong ?

Thanks in advance


texts:
I want to use hook_query_TAG_alter() for search system so I use mymodule_search_query_search_node_alter(QueryAlterableInterface $query).

What I want to essentially do is make sure that when a calendar_item, node type, is one of the results, to make sure that it's field field_date_value2 (this is the field that determines how long a calendar event or calendar item is valid, each calendar event starts at a certain date - field_date_value and ends at a particular date - field_date_value2) is greater than the current date.

So I imagine it would look something like:

function mymodule_search_query_search_node_alter(QueryAlterableInterface &$query) {
    $u_alias = $query->join('field_data_field_date', 'the_date');
    $query->fields('field_data_field_date', 'field_date_value2');
}

Now I am not adding a $query->condition(...); because this causes issues alone! I just need to know how to get in there and add the field to the query, then add a condition to that field's value!

Anyone able to steer me in the right direction? Please and thank you!

EDIT #1:
You got me to where I needed to be! Thank you very much!! I have one more follow up question, if you do not mind.

The system search will find any node that has "Training" in it. This is great, but the nodes that are of type calendar_item, I want to make sure the aformentioned TO field (field_date_value2) has a date older than current. I have modified my code above.

function mymodule_search_query_search_node_alter(QueryAlterableInterface &$query) {
     $u_alias = $query->join('field_data_field_date', 'fd', 'n.nid = fd.entity_id');
     $query->fields('fd', array('field_date_value2'));
     $query->condition("{fd}.field_date_value2", '2016-02-17T21:30:00', '>=');
}

My issue with my code above makes it so that it applies to all results, so I only grab calendar_items, I still want to grab everything, just if it is a calendar_item, to do the exclusion. I must need an outer Join?


texts: Drush make: external command could not be executed

texts:
OS: Ubuntu 14.04

php:

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Drupal: not installed yet

drush status:

 PHP executable        :  /usr/bin/php
 PHP configuration     :  /etc/php5/cli/php.ini
 PHP OS                :  Linux
 Drush version         :  6.0
 Drush configuration   :

My .make file:

; This file was auto-generated by drush make
core = 7.x

api = 2
projects[] = drupal

; Modules
projects[] = addtoany

This is my error:

$ drush make hww2.make local.hww-master2.info
Beginning to build hww2.make.                                             [ok]
The external command could not be executed due to an application error.   [error]
drupal-7.42 downloaded.                                                   [ok]
The external command could not be executed due to an application error.   [error]
addtoany-7.x-4.11 downloaded.                                             [ok]
The external command could not be executed due to an application error.   [error]

What am I doing wrong?

Thank you.


texts: Inline images are not converting to amp in Drupal 8

texts: I am using amp module with its respective themes and libraries in Drupal 8. Everything works fine other than the inline images and iframes are not converted to amp. I have enabled 'Power User: Run the whole HTML page through the AMP library' but those inline tags are removed. Is there any way to convert inline  tag to .


texts:
We are moving towards a hybrid-headless model with Drupal 7. All our data is exposed through RESTful and I have successfully built React app using the data.

How can pull that app in as a block? I put the code in a block and the app loses much of its styling and 1 third of the data is hidden. The basic functionality still works, but that's not enough.

Is there some trick to getting the a the full app to run correctly in a block?

Thank you


texts: Disable displaying user picture in page--user.tpl.php

texts: I don't want to display the user picture on the user account page. It is not a field, so I can't simply hide it in display settings. How can I disable it in Drupal 7?


texts: i am getting "Error generating image." Files permission is 777 and gd library is installed

texts:
I had installed gd library and also given 755 permission to the files but i am getting 500 - error generating issue in my drupal

My site URL is http://vestcom.ca/dev/

One of example URL of error is http://vestcom.ca/dev/?q=sites/default/files/styles/cardealer-car-mini-thumbnail/public/property-photos/IMG_1373.JPG&itok=_DfNUQVW

If anybody have any idea about how do i debug this or how can i get image then please let me know.


texts: assign role after registration (male female)

texts:
I need users to check male/female option when creating an account. Then I need to automatically assign a role male/female to the users.
How can this be achieved? Is there any module which I can use?


texts: How do I delete all entities of a bundle?

texts: I am using Paragraphs module and I can't delete paragraph type until I delete the content of the paragraph. I can use admin/modules/uninstall/entity/paragraph, but this will delete the paragraphs of all types.


texts: How to show friendly url when using Facets search?

texts:
I installed the commerce_kickstart distribution. Its products pages shows facets search blocks to filter the products.

When using these filters the url change to a not friendly url. How can change this? How to show the taxonomies terms names instead.

Look my capture below:

I mean to change this:

http://localhost/commerce_kickstart/es/products?f[0]=field_collection%3A81

to something like

http://localhost/commerce_kickstart/es/products/field_collection/cds


texts: Need to Remove Show/Hide Links Above Menus

texts:
How do I remove the Show Hide links above the menus?  See the example

I'm using Drupal 8 and Mayo theme.


texts: Posting the main url of drupal site on facebook wall

texts:
When pasting the URL of the Drupal site in question as a facebook message, the message, title and image that are being fetched from that drupal site are not the ones that are supposed to come up.
From what I gather, Facebook module and OpenGraph stuff seems needed in order to figure this out which seems overkill for this problem...

The homepage of the Drupal site is a view with some blocks in the sidebars. When you paste the URL of the site (www.mysite.com) in a facebook message, it fetches some text out of a block, and an image from some other node. Instead, I want to be able to choose which text it fetches from the site.

The answer to this question How to change facebook og:image to post image link? seems to come close and is telling me I need to use the metatag module. It doesn't explain how to go about it, but I installed the module and changed some of the values in the configuration, but didn't have any effect. Also flushed caches many times.

Also installed the fb module, I read the README.txt from the fbmodule from the beginning until the end (as asked).

I have a feeling like I don't necessarily have to get a degree in the the huge Facebook API/Opengraph rabbithole in order to get this sorted, do I?
I mean, there has to be one place where you can just determine when the text, image and title should be on the wall without too much of a huge construction around, no?


texts: Display only banners for a specific month

texts:
I need to create a View that will display a banner for a specific month (regardless of the year).

I create a field for that called, DisplayMonth, which holds an integer (so September is 9).

I would like for that banner image to change automatically for 2014. Any september month, no matter what year, it will display the record with DisplayMonth = 9.


texts: Comfortably input and edit data stored via Data module

texts:
I am building an application that stores its data in the Data module.  Displaying or querying stuff works well, simple modifications via VBO also worked.  However editing and inserting new records is problematic.

In other words, the underlying API works well and everything connected to it.  I am looking for fancy ways to input and edit data.

Do I have to write all input forms and logic by hand?  Or alternatively write Ajax handlers to include in Views (like in Data Taxonomy)?

Is there any module that can speed up the creating of input forms for the Data module?


texts:
I need to export all polls of a D6 site in XML format so that they can be imported to Django. Node export module states that one can choose to export nodes in xml using drush. However I could not find any docs to describe how to do so. I tried:

drush node-export-export --type=poll --file=xpoll

It exports the polls but in array format. I also could not figure out how to do so using the module's GUI.

So appreciate your help to get the nodes XML, preferably using a drush command.


texts: How to add alt and title attributes field for user picture?

texts:
In my Drupal project I have user picture enabled to all users, I want to add alt field and title field for Drupal user picture feature, so I can add my custom text instead of "user's picture" text.

I also want to utilize both fields in views as well.

Thanks,


texts: Why does my node-type-specific hook not work

texts:
I have implemented a hook_node_info() as follows:

function mymodule2_node_info(){
  return array(
    'mynode1' => array(
      'name' => 'MyNode1',
      'base' => 'mynode1',
      'description' => t('A Description of MyNode1'),
      'has_title' => TRUE,
      'title_label' => 'Title',
    ),
  );
}

I'd specified the 'base' property as 'mynode1', So I would expect that an implementation of mynode1_view() would work when this node is viewed.

function mynode1_view($node, $view_mode){

}

But I get the error messages instead:

Notice: Trying to get property of non-object in node_build_content() (line 1413 of
C:\wamp\vhosts\mydrupal72\modules\node\node.module).
EntityMalformedException: Missing bundle property on entity of type node. in
 entity_extract_ids() (line 7880 of C:\wamp\vhosts\mydrupal72\includes\common.inc).


texts: New Relic shows the token hook being called a lot

texts:
I've just installed NewRelic on a Drupal 7 website, and I'm now going through the most obvious issues that jump out at me.

Looking at the Drupal specific menu items, I notice the "Token" module accounts for about 1 min active time in 30 minutes clock time.

The list of hooks shows the "tokens" hook accounting for 203 seconds, which is about 80% of the total time. Each call takes less than 0.02ms, but the hook gets called over 18 million times in 30 minutes clock time. The closest one is node_view with 500 thousand calls. That seems more reasonable.

I can't, right off the bat, find a way to dig into the call tree for the Drupal hooks.

My questions:

Does the amount of calls to the tokens hook seem normal?
Is there a way in New Relic to find out where most hook invokes originate?


texts: Book module, how to restrict types of parent items

texts:
I'm using the book module where I have books and pages. I created a content type 'category' where you only need a title. The intention is that you can only add pages (with content) underneath those 'categories'.

I tried using the hook_form_FORM_ID_alter() where I altered the first select box, because the second select box works with an ajax callback I can not alter it.

Is there a way to restrict the second select box to only see types of 'category'?


texts: Undefined variable from variable in template.php

texts:
In template.php I have this function.

function my_theme_process_page(&$variables) {
    $menu_tree = menu_tree_all_data('main-menu');
    $variables['main_menu'] = menu_tree_output($menu_tree);
}

It works, but SOMETIMES it shows the following notice:

  Notice: Undefined variable: menu_tree_output on bootstrap_barrio_process_page() (líne 30 of /home/myweb/sites/default/themes/my_theme/template.php).

What am I doing wrong?


texts:
I have a custom Drupal 8 module for which I'm trying to create unit tests by following the instructions at https://www.drupal.org/phpunit.

The path of my module is: /modules/custom/dev_module
The path of my tests is: /modules/custom/dev_module/tests/src/Unit

More specifically, in the Unit folder I have a DummyTest.php file with the following code:

<?php

namespace Drupal\dev_module\Tests;

use Drupal\Tests\UnitTestCase;

/**
 * My dummy test.
 *
 * @group dummy_test
 */
class DummyTest extends UnitTestCase {

  public function testDummy() {
    $this->assertEquals(5, 5);
  }

}

When executing the following commands from the terminal (I'm on Mac OS):

 > cd core
 > ../vendor/bin/phpunit --list-groups

My group dummy_test doesn't show up in the listed groups. Any idea why?


texts: New line item every time an item is added (avoid grouping)

texts:
How can I avoid grouping of the same items (products configured identically) to be grouped in the same line item with a quantity count?

I want every single item, even if an identical already exists in the cart, to be its own line item with its own ID.

I tried several rules that fire when a new product is added to cart, when a line item is updated, tried duplicating, re-adding... even tried a timestamp field which would be different for every time a user adds an item, which should result in a new line item being created - but this is just too much of a hack for me.

Is there any clean way to create a new line item for every item in the cart?


texts: Is there any case where a module needs to implement a class using ServiceProviderInterface?

texts:
Drupal defines the CoreServiceProvider class which is used to add the twig, twig.loader.filesystem, and module_handler services.

Since the Drupal 8 way to register a service from a module is using the <module name>.services.yaml file, is there any case where a class similar to CoreServiceProvider should be used?


texts: Putting a watermark on image using Imagecache Actions

texts:
I would like to put a watermark on the images I'm uploading, but a bit differently than how imagecache does it. Since if a use imagecache for this task, the watermark is always on the image, I would like to put it below the image (t.i. if the height of the img is 500px, then the imagecache would keep it 500 + 40px for the watermark). Is there a way to do it?

Real life example: http://www.bildites.lv/images/5wbdmy4t3ezmtq3as8m.png right now it's like the image on the left, I would want it to be like the image on the right. Is there a way to do it? Keeping in mind I'm also scaling those images.


texts:
My drupal installation is still displaying summer time after the daylight savings switch yesterday. Wrong dates include the following pages:

Views displaying nodes with created/updated fields
Drupal reports
page

My timezone is set in drupal config to Europe/Bratislava. I have tested the raw date() function in the web server, and it returns the correct time.

It seems that dates are saved correctly by timestamp using a time() function; the problem is displaying. Can anybody tell what is wrong? Is it a bug, or something else?

I have already found a problem. Drupal variable date_default_timezone was set to 7200 for Europe/Bratislava timezone. In fact, the correct value for winter time is 3600 for this timezone.

Solution was to resave the timezone settings under the Drupal "Date and time" configuration within the administration menu. It will then adjust the date_default_timezone variable.

I am just curious, why is this switch not happening automatically?


texts: how can I alter the return of a search_api based View?

texts: I was hoping to alter the return of a search_api based View (coming from a solr index), so I implemented hook_views_pre_render. Though I can make some customization using a specific hook to alter the result returned by solr, that is not enough . But the $view->results array only contains the entity ID and search_api information (relevance score, fulltext snippet). All view data is supposed to be loaded by this phase. How can I alter certain field value in the view before it rendered to the end user?


texts: Form returned by drupal_get_form() won't submit

texts:
I am currently implementing an additional registration page on my drupal site, using drupal_get_form(), but I seem to be missing something cucial.

While the registration form is printed at the path I created, I can not submit the form - drupal will clear both the user and the email field and return an error claiming the form could not be submitted, because the fields were empty. They were not.

Do I need to hook up a custom validation handler? Something else?

My code so far:

function my_module_menu() {
  $items['customer/register'] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array('my_module_customer_registration'),
    'access callback' => TRUE,
  );

 return $items;
}

function my_module_customer_registration() {
  $form = drupal_get_form('user_register_form');
  return $form;
}


texts:
I have a content type that has a reference to a webform. In the template for this content type, I'd like to check if the referenced webform is open or closed to conditionally display some content.

I have a content.field_ballot[0], but this appears to just be a render array without access to the underlying webform settings.

Is it possible to access it through this reference? Or should I be investigating a different route?

Thanks!


texts:
I want to translate the title meta tag added to views on a Drupal 8 site, but I didn't see any option in the Translate View section.

How can I translate meta tags?


texts: How to show a form in Dialog Modal jquery?

texts:
Regards,

I need to display a form within a modal dialog when clicking on a link. In which the user can put data and save the data.

I thought about making a template in which I have my form, but not as display them using the method. Dialog () to show me the Modal.

Does anyone know how I can display the dialog template with the method? or does anyone have any other ideas of how to do that?

Thanks.


texts: Create a X discount for every Nth product from the same category

texts:
I know this is pretty complex task, I don't expect a solution, but a guide on where to start.

(Drupal 7 is in question)

I need to apply X% discount for every Nth products that are in the same category. Category, X and N needs to be imputed by user.

So far, I was able to make a rule (with fixed X, N and category) that calculates a needed total discount that needs to be subtracted from total amount.
How can I apply that number (or should I do something different?), and how to get user's input for X, N and category?

Thank you for any help.


texts: How to validate a form without the user pressing submit?

texts:
Right now I am working on a custom module where I have a 'view' page for viewing fields from my custom table in my database. The page basically just lists the field labels and values. I plan to have a feature to email the information on the page when the user clicks on a link/button, but only after certain fields are valid. Now if the fields aren't valid, I want to redirect to an 'edit' form page so that the user can edit certain fields. I also want to apply the form validate functions at the same time, so that inputs the user has to fix would already by highlighted in red.

However after looking at the form api and form quickstart guides, it seems to me that the only way to do that is to have the user click a submit button. Is there anyway to apply a validation function to the form right after it is loaded?


texts: In what cases should I personally sanitize input & output when using the Database Abstraction Layer

texts:
I'm trying to get a clearer sense of where security vulnerabilities on my site may lie. At no point in my code do I ever query the MySQL database directly; I always use the Database Abstraction Layer (db_query(), etc). Under what circumstances may this not provide sufficient protection against SQL injection attacks?

I am using Drupal 7.


texts: Best CSS and JS aggregation/minification strategy for D7

texts:
Drupal 6 has the awesome advagg module, which does an awesome job of intelligently bundling CSS and JS, but currently no D7 release.

What I am looking to achieve is:

less CSS and JS files (5 CSS and 5 JS files is far too many)
JS files have minification (currently core only does this for CSS)

Is there a drupal 7 solution that will help here? What are other people's experience with optimising this?

Edit: The question was originally posted in 2011. There is now a very stable D7 release of advagg.


texts:
Using: commerce+entity registration+commerce registration

During the checkout sequence, after completing the registration step, I get this fatal error:

  PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'registration-144-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_field_nom} (entity_type, entity_id, revision_id, bundle, delta, language, field_nom_value, field_nom_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => registration [:db_insert_placeholder_1] => 144 [:db_insert_placeholder_2] => 144 [:db_insert_placeholder_3] => formulaire_inscription [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => dfgh [:db_insert_placeholder_7] => ) in field_sql_storage_field_storage_write() (line 514 in /home//public_html///modules/field/modules/field_sql_storage/field_sql_storage.module).

I have tried to disable some rules that could be problematic, to disable multilanguage (entity registration have some problem whit multilang)... nothing.

What can be the cause of this error?

Thx


texts: Getting libraries to load with newer jQuery using jqmulti

texts:
I'm kind of a newbie to this so I could be missing something really obvious, but I'm having trouble getting specific libraries to load with jQuery 1.7 in noconflict mode using jqmulti. I'm working on a theme based off twitter_bootstrap, and the bootstrap.js library is dependent on more recent jQuery. I've got jqmulti recognizing and loading 1.7 if I check "load even if no libraries are assigned" but when I have that unchecked and attempt to use hook_jqmulti_files() to assign particular libraries, nothing happens.

This is what I have in my template.php:

function regent_jqmulti_files() {
    return array(
        'sites/all/themes/regent/bootstrap/js/bootstrap.js',
        'sites/all/themes/regent/bootstrap/js/bootstrap.min.js'
    );
}

but when I look at my rendered html, the library is loaded, but nothing about noconflict mode,  and jQ 1.7 is nowhere to be found. I'm sure I'm missing something basic and stupid, this being the first time I've tried to set something like this up.


texts: How to insert html tags to a node content?

texts:
I am wondering is it possible to insert a plain full html tags to a node content? Currently I have a node content type having a list of fields, but if I add some html tags in tpl.php file for that node, the html tags are actually outside the main content of the node field (but I want to put new-added html tags inside that.)

Can anyone brief me what is the best way of doing that?

Regards!


texts: Programmatically added comment form on node page doesn't work

texts:
I have attached a view which displays comments to basic page content type using EVA module. I've also implemented the following to have the "add comment" form displayed just above the comments list:

/**
 * Implements hook_views_pre_build().
 */
function mymodule_views_pre_build(&$view) {
  if ($view->name == 'page_comments') {
    if ($node = menu_get_object()) {
      $comment = new stdClass;
      $comment->nid = $node->nid;
      $form = drupal_get_form('comment_form', $comment);
      $form['#redirect'] = current_path() . '?page=' . (int)$_GET['page'];
      $header = drupal_render($form);
      $view->add_item('default', 'header', 'views', 'area', array('content' => $header, 'format' => 'full_html'));
    }
  }
}

It should work like this:

on page /node/12, which contains the node, comment list and the "add
comment" form, the user enters new comment and submits
the page reloads quickly
the submitted comment appears in the comment list on the same page,
together with another "add comment" form

What actually happens:

as above
user is redirected to page /comment/reply/12 which also contains the
node, comment list and the "add comment" form
however, the previously submitted comment is lost, it doesn't appear
in the database or anywhere else
the user can then again enter a comment and submit
if he does so, he is redirected to page /node/12#comment-1561, which
contains the node, comment list and the "add comment" form
the second submitted comment is on the comment list

So there are two problems with my added form: comment is not submitted and there is redirection. What needs to be done to make it work the way it should?


texts: How can I listen for drupalOverlayBeforeClose in custom jQuery?

texts:
I am monitoring a particular form for changes and want to warn the user before they attempt to navigate away from the form without submitting it. I've successfully gotten this working in all instances except for the overlay close button – because that element is bound to the Drupal.overlay.close() function, a user is able to click it and immediately close the overlay, even though I'm listening for all $('a') clicks.

I looked inside of modules/overlay/overlay-parent.js and see that it provides the drupalOverlayBeforeClose event so that other scripts can respond and stop the overlay from closing if needed, but I can't figure out how to implement this. Do I just listen for this event globally, through the $(document) or something? Or do I need to extend the Drupal object and attach my function to this event somehow?


texts: CKEditor Inline Styles Getting Removed on save

texts:
I am trying to edit the font size for CKEditor, however whenever I save these changes, the inline styles are removed.

Now I saw that it may be due to a custom Javascript configuration issue, and so I've put this in the Advanced Options dropdown:

config.allowedContent = true;

Even after putting this on both full and filtered, I've had absolutely no luck getting my inline styles to stay correct. What am I doing wrong? Is this a CKEditor problem, or a Drupal problem?

Nevermind, this is only happening on filtered. So I'm pretty sure it's just a Drupal setting in how filtered is configured. I'll post the solution soon.


texts:
How can I add or implement a semantic search functionality in my site?

I have rdfx and schema.org modules in my site to add semantic data to my content so I need a way to add semantic search functionality to my site.


texts: hide passwords in drupal module settings

texts:
we have a local community site for drupal and site is run by volunteer admins. my question is, is there any way I can 'hide' passwords in module settings? some modules ask for user password of the service they integrate. it's not safe to have them in plain text in their settings page.

and I don't want to restrict access to those module settings.

this is a common issue with drupal. you can create the permission using hook_permission in your own module. then in your own module use hook_form_alter, find the form of the module andon those password fields use '#access' => user_access('your_permission'). but I have no idea how.

for example, Bot module has a password field. Mailchimp has API Secret field. etc


texts: Uploaded images deleted on save in Drupal

texts:
A certain content-type in my installation does not save images in it's gallery anymore.

The image is being uploaded, registered in file_managed with status 0, and stored in sites/default/files.

On save the status does not get updated to 1 in the database, therefore the file gets deleted.

I entered some debug code, and it turns out that file_field_presave() never even gets called for the uploaded file.

Curiously on my testing copy of the same system it works, the function gets called and the status is updated to 1 in the database.

I compared the content-type and field-type settings, and they are the same.

I also compared all drupal-files again (diff -r), except for database configuration ant .htaccess they are the same.

update.php doesn't do any update, and the modules have no security updates pending.

How could I debug the problem? I don't know how to look deeper. Is it possible that the database is somehow inconsintent?

Thanks a bunch for your help people.


texts:
Good evening, I created variations for products and when I add references to the display product, I get the following error "error message The Data 1 uses tokens (tokens) following invalid: [node : field-product: commerce_price] ".
Look at the setting in the screenshot below


texts: Get yesterday's content with contextual filter in views block

texts:
I have a view and I try to show only yesterday's content.
I add a contextual filter "Content: Created date".
If I select "Current Date" from "Provide default value" its works perfectly.
But I select "PHP Code" its not working whatever I write. I try a lot of format.

In this topic there is a solution but its not work either;

return date("d", strtotime("-1 day"));

How can I do that?


texts:
I created a Drupal 8 module and I would like know what is the best practice for testing my code?

For example, if I use hook_user_login(), how I can try my code without login/logout every time and how do I display my var_dump() result? (var_dump result not displayed due to redirection after login)


texts: How can I load a menu programmatically with an active trail set by a provided URL?

texts:
Working on a headless Drupal site, and have come across an issue. We have a REST resource that returns arbitrary menus by menu-id, however they always have "active-trail" set to false on every menu item.

I'd like to be able to specify a URL or route when building the menu and have the active-trail be equivalent to what it would be if the menu was loaded on that route.

At the moment our solution is to loop through every menu item until we find one that corresponds to the provided URL, and then mark it and all its parents as "active-trail", however this seems unnecessarily cumbersome and I'm left wondering if there's a more sensible solution we've overlooked.

Currently we're loading menus like this:

$tree = $this->menuTree->load('menu_id', new MenuTreeParameters());

Where $this->menuTree is an instance of MenuLinkTree being instantiated via Dependency Injection:

/**
 * {@inheritdoc}
 */
public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, MenuLinkTreeInterface $menu_tree, EntityTypeManagerInterface $entity_type_manager, Request $current_request) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);

  $this->menuTree = $menu_tree;
  $this->entityTypeManager = $entity_type_manager;
  $this->request = $current_request;
  $this->alias = $this->request->query->get('alias');
}

/**
 * {@inheritdoc}
 */
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  return new static(
    $configuration,
    $plugin_id,
    $plugin_definition,
    $container->getParameter('serializer.formats'),
    $container->get('logger.factory')->get('rest'),
    $container->get('menu.link_tree'),
    $container->get('entity_type.manager'),
    $container->get('request_stack')->getCurrentRequest()
  );
}


texts: Can Commerce Kickstart be used to add Drupal Commerce to an existing site?

texts:
I want to add the Drupal Commerce module to my existing Drupal website. Is there any way I can use the Commerce Kickstart dstribution for an existing Drupal site?

Seems like you're supposed to use Commerce Kickstart when you're starting to build your Drupal site, but I already built mine.

According to the Commerce Kickstart website it says: "Anyone who wants to skip weeks of configuration to build a commerce site on the Drupal Commerce framework".

Is it really that hard to install the Drupal Commerce module without Commerce Kickstart?

I'm not creating a big store, I just want to sell 1 or 2 items.


texts: Proper way to invoke jQuery UI menu widget

texts:
I'm trying to theme a menu using the jQuery UI menu widget.

Here is what I've added in my template-preprocess.php inside the preprocess_page hook:

drupal_add_js('(function ($) { jQuery(document).ready(function () { jQuery( "#test-menu-id" ).menu(); }); }(jQuery));', 'inline');

I'm using jQuery Update to set my jQuery version, and according to the status report it is:

jQuery 1.8.3
jQuery UI 1.10.2

However, whenever I load the page to test I get the following error:

Uncaught TypeError: jQuery(...).menu is not a function

According to http://api.jqueryui.com/menu/ the menu widget was added in version 1.9.

If I manually add the external JS file from https://code.jquery.com/ui/1.11.4/jquery-ui.js, then it works (though this is obviously not the appropriate solution).

Can any one share any insight into why this would be happening, or provide any advice?

Thanks,
Pablo


texts: Drupal 7 -- Would like to use unique profile template per role

texts:
I'm working on a Drupal project where we have two main roles (students/teachers) + an admin role. I would like to have entirely different profile pages for the different roles.

At the moment I think the most maintainable method for doing this is going to be to have several profile template files that are called when the specific role is being viewed; I'm just not sure how to preprocess the profile to hint at the correct template.

At the moment, I've built some page pre-processing code to check the role of the profile page we're looking at as follows:

function MYTHEME_preprocess_page(&$vars, $hook) {

  // See if we can influence profile pages
  $content = $vars['page']['content'];
  $theme = $content['system_main']['#theme'];

  if($theme == 'user_profile') {
    $roles = $content['system_main']['#account']->roles;

    if(in_array('teacher', $roles)) {
      $vars['theme_hook_suggestions'][] = 'teacher__user-profile.tpl.php';
    }
    elseif(in_array('student', $roles)) {
      $vars['theme_hook_suggestions'][] = 'student__user-profile.tpl.php';
    }

  }

}

The conditional correctly identifies the profiles being for teachers or students but I can't seem to influence it by suggesting a profile template.

Any thoughts?

Thanks,
Andrew


texts: How to make DrupalChat more stable, to have it recognise online users?

texts:
Never had any luck with the DrupalChat module. It is always flickering on and off, saying other users are currently offline when they are on.

Does anyone have any tips or tricks for making DrupalChat stable?


texts: Which button id triggered the form submission

texts:
My module hade a form and the form have 5 buttons: create, edit, save, etc.. also my module form use ajax to send the requests, and the function look like this:

$form['dialogCreateButton'] = array(
    '#type' => 'button',
    '#value' => t('Create'),
    '#ajax' => array(
        'callback' => 'form_kalendar_dialog_validate',
        'progress' => array(
            'type' => 'throbber',
            'message' => t('Please wait...'),
        ),
    ),
);
$form['dialogSaveButton'] = array(
    '#type' => 'button',
    '#value' => t('Save'),
    '#ajax' => array(
        'callback' => 'form_kalendar_dialog_validate',
        'effect' => 'fade',
    ),
);

This are only two of the buttons, but it's does't matter much because the problem is in the theme (template) side regarding javascript, not on the server side.
In my template file I call the form with: print drupal_render(drupal_get_form('form_kalendar_dialog')); it works fine, but on submit I would like to make some changes on the DOM with jQuery and I need to know witch button fired the form submit!

Drupal.behaviors.rr = {
    attach: function(context, settings) {
        jQuery("#edit-dialogcreatebutton").click(function(event) {
            console.log('dialogcreatebutton');
        });

        jQuery("#edit-dialogsavebutton").click(function(event) {
            console.log('dialogsavebutton');
        });
    },
    detach: function(context, settings){
        jQuery('#dialog').dialog('close');
    }
}

With the above function on detach it close the dialog where the form is, but I would like to find out witch button is the trigger, what is the response of synchronised request made to server (stored in a variable not stored in a  tag) and to add event on every button to make new changes on DOM, based on form inputs!

<form action="/?q=kalendar" method="post" id="form-kalendar-dialog" accept-charset="UTF-8">

  Event title
 <input id="dialog-event-title" type="text" name="event_title" value="" size="40" maxlength="200" class="form-text">

When

  Sunday, 29 May 2016, 12pm - 12:30pm
 <input id="dialog-event-date" hidden="hidden" data-time="Sunday, 29 May 2016" type="text" name="event_date" value="" size="40" maxlength="120" class="form-text">

<input type="submit" id="edit-dialogeditbutton" name="op" value="Edit event" class="form-submit ajax-processed"><input type="submit" id="edit-dialogcreatebutton" name="op" value="Create" class="form-submit ajax-processed"><input type="submit" id="edit-dialogsavebutton" name="op" value="Save" class="form-submit ajax-processed" style="display: none;"><input type="submit" id="edit-dialogdeletebutton" name="op" value="Delete" class="form-submit ajax-processed" style="display: none;"><input type="submit" id="edit-dialogdiscardbutton" name="op" value="Discarc changes" class="form-submit ajax-processed" style="display: none;"><input type="hidden" name="form_build_id" value="form-_ivUkOlvspquqr1Bl6rIRULqbj3rmxUXdZiA25-ZFG8">
<input type="hidden" name="form_token" value="SJ3DhMEcrrcT6QkiPJE9EGyjtQ4qCMpuhwkw7zDAvdY">
<input type="hidden" name="form_id" value="form_kalendar_dialog">

</form>


texts: Image Derivatives for Private Filesystem not being generated

texts:
I'm trying to keep all files on a D8 site in the private filesystem so that I can rely on Drupal to deal with the permissions. The problem is, it seems like when an image is in the Private filesystem, it's derivatives (image styles) don't get created. The original image is available (at system/files//, and rightfully NOT available to those without permission (for instance, anon can see it if it's published, but can't get to the file at it's URI if I unpublish that node.)

Apache has full read/write access to the private directory (which I have one level up from the Drupal root directory), as should hopefully be evidenced by being able to put the raw image file in.
When I switch to public filesystem, it works, so (in addition to having checked all the permissions for /tmp and even trying alternative tmp folders) I don't think it's a /tmp directory issue
I'm using the media module, so also the file_entity module
This was working at some point, but a Drupal update seems to have broke it (or, at least, it was good timing.) This is my own personal project, so it was some time ago and I'm only now getting around to trying to fix it.
I've attempted in on multiple sites on the same server, and they both do it.

Both were Drupal 8, and I tried with both PHP 7 and 5.6


texts: Getting The Docroot From $data in provision_apache_vhost_config With Aegir3

texts:
I'm trying to write a custom vhost hook for Aegir3 and I need to get the site's docroot path.  I can see that the info I want is being passed in the second variable ($data) but I can't figure out how to access it.  It seems like there is an object $data['server'] that is of a custom Provision_Context_server class.

Can anyone provide an example or point me at some documentation on how to interact with that?  I was hoping to be able to just use $data['server']['services']['http']['context']['site']['root'] but that doesn't seem to work.

EDIT:
I managed to get to the data as follows, but it's an ugly hack:

  preg_match('/"root";s:\d*:"(.*?)"/', serialize($data), $aryMatches);
  $docRoot = $aryMatches[1];


texts: How can I find out if the present theme version would work

texts: In the last years I've used pixture reloaded, a subtheme to adaptive theme, on some drupal sites and I was wondering whether this will work on Drupal 9. I've seen that the Adaptive theme homepage has not been reachable for some weeks and that the last update of Adaptive themes was 3 years ago. So I don't expect them to further develop the theme. How can I find out if the present version would work in Drupal 9?


texts: How allow moderators to give a rebuke to user

texts: I'd like to allow moderators to give a rebuke for users. If user has e.g. 3 rebukes, the account of user should be removed or blocked - automatically or moderator should be inform about it.


texts: Accessing sub-array data from theme_field__custom_content_type($variables)

texts:
This is a mix of a PHP and a Drupal question.

I created a custom function...

theme_field__custom_content_type($variables)

I have the DEVEL module installed and have been using it profusely. I'm trying to modify the layout/look of a custom content through a childtheme I'm developing. I'm running into an issues that is leaving me scratching my head.

I have a custom content type [netrunner_card] and it has several fields that are taxonomy references. One field in particular is [field_card_subtype]. A card can have multiple subtypes... "Location," "Seedy," "Cloud," etc. What I want to do is to take those subtypes and place them next to another field like so:

field_card_type : field_card_subtype[0] - field_card_subtype[1] - etc

So that you would see output like:

Operation : Location - Seedy

ICE : AP - Trap

etc.

What I am doing is the following...
Yes, I am creating custom variables for this as it helps to collect everything in an easy to use package.

$blinksFieldName = $variables['element']['#field_name'];
switch( $blinksFieldName )
{
    case 'field_unique_card':
        $variables['card_is_unique'] = $variables['element']['#items'][0]['value'];
        break;
    case 'field_card_subtype':
        $variables['card_subtype_list'] = implode( " - ", $variables['element']['#items']);
        break;
    ...
}

When I kpr( $variables['card_subtype_list'] ) I get a string of the word 'Array'. I think that's because the breakdown of the variable in question is more like:

$variables['element']['#items'][0]['#title']

I'm very confused how you reach that level of the array when one of the placeholders is the array index... I had thought to do a for-next but I can't figure out how I would word it? Any help would be greatly appreciated.


texts: Content type template only for viewing, not editing

texts:
I've added a page template to override certain content types

function THEMENAME_preprocess_page(&$variables) {
  if( !empty($variables['node']) ) {
    $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
  }
}

This successfully uses page--node--vendor.tpl.php instead of page.tpl.php

The problem is that it is also using this template when editing the node, which looks rather silly. How can I modify this to only use the template when viewing content and not when editing?

** Yes, I do want Drupal to use this theme when creating/editing content, and not a separate admin theme.


texts: Correct way to access field values? field_view_value after field_get_items?

texts:
So I want to get some field values that I need as input, sometimes for rendering.  According to this page:

http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way

It is a mistake to hard-code 'und' for internationalization, so to avoid this the author says that we should use field_view_field().

I personally, don't need all info related to the field, just the value.  So I opt for field_get_items() and then field_view_value() as outlined in the blog post.  But this seems a lot of work just to get a single value of a field (plus we have to find and load the node).  Do we really have to do so many steps to get a simple field value?  I would have thought that this would be a very common function that users need.

I'm wondering that, barring any simple method, I could just grab the value directly from field_get_items()[0]['value'].  Maybe the drawbacks are that it doesn't pass through any sanitation routines?   You can see more info here (trying to grab 'axis1t'):

Just looking for possible alternatives because my code is becoming somewhat bloated to keep getting field values this way along with the fact that they are burried inside field_collections.


texts: How do I display a username on their profile pages?

texts:
Using Drupal 8, I simply want a user's profile (or account) page to show its username, like so:

For username "bob":

Username: bob

Do I add a computed field? What's a line of code would I use?


texts:
I was told to migrate a Drupal website, but I've never worked with it before so I'm having some difficulties here. I'm trying to run the site in localhost/myfolder.

The URL generated for images is:

/sites/default/files/images/myFile.jpg

The link is broken because it should be:

myfolder/sites/default/files/images/myFile.jpg

I have this on my sites/default/settings.php file:

$base_url = 'http://localhost/myfolder';  // NO trailing slash!

I also added this to my myfolder/.htaccess file:

RewriteEngine on
RewriteBase /myFolder

I ran out of ideas, any help would be deeply apprecciated. Thanks.


texts: How do you export configuration from configuration module

texts: I need to include the configuration that I track in configuration modules into my install profile or however I will allow so that it will be initialised on install. How do I do this?


texts: Form fields created via Ajax are missing element attributes

texts:
I have a custom form with a date field and a series of textfields and number fields. The textfields and number fields are dynamically re-created via an ajax callback function that runs whenever the date field changes, because the default values of the textfields and number fields will depend on the value of the date field.

The form runs this function once upon loading, which works fine, it returns the $form object with all expected values in the fields.

However, whenever that same function is called again by the ajax trigger, almost all of the attributes of the dynamic fields are missing. The data-drupal-selector, id, name, and value attributes are gone. The default values do not appear. The for attribute of labels also disappears.

I have noticed that this is not true of table form API elements and only seems to affect input elements and labels.

Is this the expected behaviour? Is it avoidable?

Example:

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['date'] = array(
        '#type' => 'date',
        '#ajax' => [
            'callback' => '::dateCallback',
            'wrapper' => 'wrapper',
        ],
        '#default_value' => date("Y-m-d")
    );
    $form['wrapper'] = [
        '#type' => 'container',
        '#attributes' => ['id' => 'wrapper'],
    ];
    $this->dateCallback($form, $form_state);
    return $form;
}

/**
 * Implements callback for Ajax event on date selection.
 *
 * @param array $form
 *   From render array.
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *   Current state of form.
 *
 * @return array
 *   Date selection section of the form.
 */
public function dateCallback(array &$form, FormStateInterface $form_state) {
    //insert logic to determine value of a variable called $field1

    $form['wrapper']['options'] = array(
        '#type' => 'fieldset',
        '#attributes' => array('class' => array('options'))
    );
    $form['wrapper']['options']['field1'] = array(
        '#type' => 'textfield',
        '#title' => "Field 1",
        '#default_value' => $field1
    );
    $form['wrapper']['table'] = array(
        '#type' => 'table',
        '#title' => t('Table'),
        '#header' => array("H1", "H2", "H3"),
        '#attributes' => array('class' => array('custom-table'))
    );
    //insert logic to generate table rows
    return $form['wrapper'];
}

(Note: In order to get ajax to work with date fields, as per my previous question, I had to apply a Drupal patch. However, I am pretty sure this issue is not related to this patch, as the problem persists even if I attach the callback to another form APi element like a Select dropdown.)


texts:
I'm trying to migrate from a SQL table using migrate module.
The fields in the table are a unique file hash (media), an url, a drupal internal path.
In the class extending SqlBase I have this function:

  public function getIds() {
    // The row property that represent the unique id for the id map.
    $ids['media'] = array(
        'type' => 'integer',
        'alias' => 'm');
    return $ids;
  }

It seems that migrate only accepts integers and requires ids to fill its migration map.
Is there a way to migrate with a string hash or without any id?


texts: How do I remove the rollover effect from Rubik tooltips

texts: I am using Rubik and the tooltips are rollovers. Generally this is fine, but for one site I need them to display with the field instead. Is there a setting to disable the rollover effect and just make it look like help text?


texts: How to add more fields after submission?

texts:
I was wondering how to add more fields to a form after submitting that form.
So the form should have these fields for example:

Name (textfield)
City (select list)
Find (button)

and then when user performs the submission, the result page should look like this:

Name (textfield)
City (select list)
Gender (radio buttons) <-- so they can refine the search by gender
Find (button)

How do I achieve that?


texts:
I have developed a custom module, containing a .module, a tepmlate-tpl.php , a .info, a .install a .css and a .js file, for a functionality I need for my Drupal-7 site.
Although I know how and have already placed it at a new page(via .module file), I want to place the exact functionality/display at an existing node, where the node--xx.tpl.php already has it's own content.
I want to render the whole module inside the node's tpl or using another method.
Is this possible?
Thanks in advance


texts: Drupal 7 - Change specific text based on user's country?

texts:
I'm new to drupal. I'm building a contest site where I display the cash prize for the winner on the front page. I want to change the prize amount and the currency sign based on the user's country.

For Example :
If a person is from Europe then show £50 and for the rest show $25.

Is there a module for that ? or Can I hard-code that in the page--front.tpl.php ? (I know we shouldn't hard-code in template files but this is the simplest solution I have so far)

Note : I don't need currency conversion or exchange rates, I just want to change the text based on the user's country.

Thanks in advance.


texts: How to change authoring information with Rules?

texts:
I'm trying to create a rule that fires upon saving a node with a few conditions.  The rule takes the current author, and sets it in a field called "field_original_author" and after that changes the value of the current author information to a particular author.

It does the first bit but not the second. Even if I only use the second part, it still doesn't change the author information into the other author that I specified.

What gives?


texts:
I've tried to change this code to show the term name instead of the term ID
but now no term name or term id show at all

Orginal code for term ID

function MYTHEME_preprocess_node(&$vars) {   if (array_key_exists('content', $vars)) {
    $content = &$vars['content'];
      if (array_key_exists('field_photo_topic', $content)) {
        foreach ($content['field_photo_topic']['#items'] as $index => $info) {
          $tid = $info['tid'];
          $content['field_photo_topic'][$index]['#href'] = 'photos/' . $tid;
        }
      }   } }

What I changed it too

function MYTHEME_preprocess_node(&$vars) {   if (array_key_exists('content', $vars)) {
    $content = &$vars['content'];
      if (array_key_exists('field_photo_topic', $content)) {
        foreach ($content['field_photo_topic']['#items'] as $index => $info) {
          $term_name = $info['term_name'];
          $content['field_photo_topic'][$index]['#href'] = 'photos/' . $term_name;
        }
      }   } }

Many thanks for your help


texts: Multisites placed inside sub site folder?

texts:
I have my main plain html site in root folder and drupal site in sub site folder. Now I am wanting to create multisites and wonder if  sub sites can reside in drupal sub site sites folder?

www.subdrupal.mainsite.com/subdrupal/sites/sub2drupal  etc.

Or must I start again as it can only be www.subdrupal.mainsite.com/sites/subdrupal ?


texts: D6 - Create a files table entry for a file

texts:
I have to migrate some content and everything is fine except the images.

I'm getting the images using file_get_contents() and save the file in the drupal /files folder using the following code:

    $image = file_get_contents('http://www.someurl.com/xx/util/yy.jpg');
    $file = file_save_data($image, 'yy.jpg',FILE_EXISTS_REPLACE);
    print $file; // returns the path to the file ( /files/yy.jpg )

So the image is uploaded in the /files folder.

What I'm not able to understand is, how can I add the image to the files table so that I can be able later to use the file object?

I was looking through the files.inc functions for Drupal 6 but I wasn't able to find anything that could help.
Should I insert the data manually using db_query()?

Thanks.


texts: What tables are affected by "drush cc all"?

texts:
What database tables are affected from drush cc all?
Obviously, I could gather all the tables starting with cache_.

Is there any other table that is affected by this command?


texts: Alter comment links in blog teaser in drupal 7

texts:
I would like to alter the comment links in the teaser view of the blog page. The code I have in node--blog.tpl.php at the moment is:

<?php if ($display_submitted): ?>

<?php $date = date("d F Y", $node->created); ?>
<?php print $date; ?>

 <?php $user = user_load($node->uid); ?>
        <?php $username=$user->name; ?>
<?php print t("By"); ?>
<a href="blogs/<?php print $username ?>"><?php print $username ?>

 <?php print ($comment_count); ?> <?php print render($content['links']['comment']); ?>

>

with css: .submitted ul li span {
        color: #fff;
        background: url("../images/blue-bubble.png") 0px 2px no-repeat;
        background-size: 100% 96%;
        padding: 0px 5px 5px 5px;
}

which produces:

but I want to make:

Any suggestions on this would be great!

Thanks


texts: I am using postgresql as database. I want to create views of webform submissions. is there anything similar to webform_mysql_views for postgresql.


texts: Data, Feeds, Schema & Views module. Have I got the right idea?

texts:
I am thinking of using the following modules to import simple data from a csv file in order to be able to search by a couple of fields. I don't want the data to create new pages, I just want the data to be searchable and then displayed in the search results table format. To display the search results I am hoping to use the Views module.

Modules I am thinking of using:Data, Feeds, Schema, Views.

Have I got the right idea? Are these modules right for what I want to do? If so, where do I start?

By creating a new content type and the necessary feilds? Do I then Create a new table using the Data module? I guess I would then create a Feed and then finally a View. Is that correct? But where does the Schema module fit in?


texts:
Does anyone has issue with mac Xampp localhost? Everything seem fine after I imported online Drupal site and database to Xampp(1.8.2-4) localhost. However, after I hit the login button on the login page( [https://localhost/user][1] ), it gave me "access denied". That's mean I cant login at all.

Best,
CocoSkin

it gave me the error message after i run drush upwd admin --password=YOURNEWPASSWORD

~ here is the error message ~

HH5765-122A-M1:~ cocoskin$ cd /Applications/XAMPP/xamppfiles/htdocs
HH5765-122A-M1:htdocs cocoskin$ drush upwd admin --password=MYNEWPASSWORD
Command user-password needs a higher bootstrap level to run - you    [error]
will need to invoke drush from a more functional Drupal environment
to run this command.
The drush command 'upwd admin' could not be executed.                [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
 * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

Drush was attempting to connect to:
 Drupal version         :  7.26
 Site URI               :  http://default
 Database driver        :  mysql
 Database username      :  test_drupal
 Database name          :  test_drupal
 Default theme          :  garland
 Administration theme   :  garland
 PHP executable         :  /usr/bin/php
 PHP configuration      :
 PHP OS                 :  Darwin
 Drush version          :  6.0-rc4
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Applications/XAMPP/xamppfiles/htdocs
 Site path              :  sites/default
 File directory path    :  sites/default/files


texts: Drupaliest way to remove login and registration page descriptions

texts:
How to remove the descriptions from log in and registration page ?

I need to remove the description from the fields which are listed in the images.

These are both log in and registration page.

How can i do this?


texts: Referencing a paragraph field in a field--node template

texts:
I need to reference field_role from a paragraph inside of a field--node template. The paragraph is an unlimited repeating field in the content type. The field template I am working with is the field in the content type which references the paragraph entity.

In the field template:

{% for item in items %}

    {{ paragraph.field_role }}

{% endfor %}

I've tried {{ content.field_role }} and {{ item.field_role }} as well.

Separately, I've also tried creating a preprocess hook for the field.

function theme_preprocess_field(&$variables, $hook) {
  $paragraph = $variables['paragraph']->field_role->value;
  $variables['var_role'] = $paragraph;
}

function theme_preprocess_entity(&$variables) {
  if ($variables['entity_type'] == 'paragraphs_item') {
    if(isset($variables['elements']['field_role']['#items'][0]['value'])){
      $variables['var_role'] = $variables['elements']['field_role']['#items'][0]['value'];
    }
  }
}

(I know this would only pull the first item from the repeating field, but I'm just trying to get anything to render at this point.)

How can I achieve what I am trying to do?


texts:
I make a form programmatically, and I am looking how a web designer can change render.

 public function buildForm(array $form, FormStateInterface $form_state)
{

    $form['metier'] = array(
        '#type' => 'search',
        '#title' => $this->t('Métier'),
        '#default_value' => '',
        '#placeholder'=>'Rechercher une personne par son métier',
        '#attributes' => array('title' => $this->t('Rechercher une personne par son métier')),
    );

    $form['position'] = array(
        '#type' => 'search',
        '#title' => $this->t('Où'),
        '#placeholder'=>'Où',
        '#attributes' => array('title' => $this->t('Où')),
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => $this->t('Search'),
    );

    return $form;

}

If the path of my form is /test the suggestion template form--test.html.twig doens't work.

I would like give access to a template for webdesigner can custom the render.

I can do something like that :

  $form['metier'] = array(
        '#type' => 'search',
        '#title' => $this->t('Métier'),
        '#default_value' => '',
        '#placeholder'=>'Rechercher une personne par son métier',
        '#attributes' => array('title' => $this->t('Rechercher une personne par son métier')),
        '#prefix'=>'
',
        '#suffix'=>'
'
    );

But it's hard coded.

So I am looking for a way to return a brut table and let the web designer make his template.

The best way for the designer ll be :

form--test.html.twig

{{ form.metier }}

{{ form.position }}

{{ form.submit }}

I don't know if I am right, I have try to return my variable $form to a template like that :

return array(
    '#theme' => 'form_test',
    '#form' => $form,
  );

All work I can access to my fields with

  {{ form.metier }}
  {{ form.position }}
  {{ form.submit }}

But the submit button doesn't work because the hidden fields are not display like the form_token and he is not in my variable $form.


texts: How to access existing data in the row during Migrate?

texts:
I'm using the Migrate module to import data but I want to compare existing data in my Drupal content for one specific field before I overwrite it during an update migration.

PrepareRow() doesn't seem to have access to the destination data.  I was hoping that Prepare() would as the inputs to prepare($entity, stdclass $row) suggest it has the entity in hand, however it appears that this entity is the fully constructed row it is about to import rather than the data from the destination object.

Is there any way I can get access to the unaltered destination row to do a comparison with my source row before the import happens?


texts: I need to unset terms from the drop down

texts:
I'm writing a module to unset taxonomy terms using D6 hook_form_alter(). The object is to only present the current user terms which they have created themselves.

The trouble is that I don't know which variables to alter. I'm thinking it should be something like $form['taxonomy']['2']['#options'], but I cannot see a path in a DSM print_r($form).

I have gone through hierarchical_select.module again and again, but can't work out whether I need to be amending the results of $storage, $elements, #names, $hsid or any of the other variables; I am not sure about which hook to use too.

I just need to know how to apply the results of this db_query() in my custom module code which you can see on http://pastebin.com/RbwKB0rt.

Can anybody please help?


texts: Hi I would like to give all organic group pages a custom theme and layout. How would I go about doing this? For example, I want the main site pages to follow a certain theme/layout, but when you go to any group page the theme and look is entirely different. Is this possible?


texts: What hooks are being invoked on a node edit form

texts: I'm using Drupal 6 with many modules. It often happens that I'm trying to track down which hooks are being invoked on a specific form, but up till now I've been making educated guesses. How can I figure out which hooks are being invoked on a node edit form (or other forms)?


texts: How to temporarily replace Drupal with static HTML pages?

texts:
I'm a JavaScript dev with no Drupal experience.

I'm working with a church to redesign their Drupal site after their dev moved on without leaving any notes/documentation/etc. In the meantime, I'd like to put up a few static html pages in place of the Drupal site, without getting rid of all the Drupal data.

Can I just "turn off" Drupal, so that routes that are now currently powered by Drupal (ie: church.org/worship) will instead render the static file version (ie: church.org/worship/index.html)?

Is leveraging Drupal's "maintenance mode" a possible solution? I found this article, https://drupalden.co.uk/static-maintenance-page-replace-drupals-default-maintenance-mode-page, on replacing the default maintenance page, but what about other routes too?


texts: Language switcher block is different on remote site

texts:
I'm working on a multilingual site and on my local version of the site I added the default language switcher. It show like this:

                    English

                    Français

And when I click the link to go to the french version of the site I am send to the /fr/a-propos page. Just like I'd expect.
Now I pushed my site update to my remote server. Looking at the code there. I see the switcher is different:

                English

                Français

The language switcher has a different class not language-switcher-language-url but language-switcher-language-content-entity so my styling is off. I changed to using the ID instead so the styling problem is fixed. but still strange things are happening. Sometimes when I click a link in the switch the url has the language_content_entity as parameter. And currently the active state of the language switch is not working on the remote site?
Using git both sites are exactly the same. The config is the same on both sites and I cleaned cache on my remote site.
Why is this code different on my remote site?


texts: Programmatically fill the "Publish On" date field value provided by the Scheduler Module

texts:
I'm using the Scheduler Module to schedule the publishing date of the content in my Drupal 8 site. I would like to programmatically fill the value of the Publish On date field provided by the scheduler module.

In Drupal 7, I used the following code

function hook_form_alter (&$form, $form_state) {
     $date_format = (_scheduler_use_date_popup()) ? SCHEDULER_DATE_FORMAT : variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT);

      $form['scheduler_settings']['publish_on']['#default_value'] = format_date($querydate, 'custom', $date_format);
}

This code doesn't work in Drupal 8, since the _scheduler_use_date_popup() function and the SCHEDULER_DATE_FORMAT constant are not available.

I'm using the following code in Drupal 8 which doesn't work:

function hook_form_id_alter(&$form, FormStateInterface $form_state) {
    $form['scheduler_settings']['publish_on']['#default_value'] = \Drupal::service('date.formatter')->format($contest_start_date, 'custom', 'Y-m-d H:i:s');
}


texts: Add external CSS file with custom backend setting

texts:
I'm trying to add a external CSS file. The client wants to be able to change the url from the backend. Creating a backend settings form is not an issue, but I can't seem to get the file loaded in the frontend.

My code:

function MYTHEME_library_info_build() {
  $libraries = [];
  $libraries['mylibrary'] = [
    'version' => '1.0',
    'css' => [
      'base' => [
        'https://www.mywebsite.com/css/styles.css' => [],
      ],
    ],
  ];

  return $libraries;
}

The fixed url will be replaced with a variable containing the value entered in the backend.


texts: Unable to join users table to the other tables using query?

texts:
For Drupal 7,
Field abc and field def both belong to same content type

$query = db_select('field_data_field_abc','ex')
  ->fields('ex', array('field_abc_value'));
$query->join('field_data_field_def', 'fsr', 'fsr.entity_id = ex.entity_id');
$query->addField('fsr', 'field_ort_target_id');
$query->join('node', 'n', 'ex.entity_id = n.nid');
$query->addField('n','changed');
$query->addField('n', 'uid');
$result = $query->execute()->fetchAll() ;

In the above query how can I get the user uid and user name using relation between node uid and user uid.
Bcoz. when I joined the users table , my results are empty


texts: Mixed Language Negotiation (Prefix and domain) in D7

texts:
We have a single code base and database for all the 3 languages of a certain website:

http://example.com/ - default, no prefix, English
http://example.com/pt - pt prefix, Portuguese
http://example.com/ru - ru prefix, Russian

However, we now want to change the Russian domain to http://example.ru (no prefix)

What's the best way to attain this without affecting the previous domains and urls?

Best regards


texts:
I created a module with a hook_menu() to redirect every $items[%node] to drupal_goto('<front>'). Is it possible to do the same for every alias path and how would I do that?

The background is that it's a one-pager with all nodes displayed only on the <front> page. No single node should be viewed. Nevertheless every single node has a Facebook Like Button and so has to be like-able/share-able with Facebook. But that's another story, on the whole.


texts:
I created a custom module that uses the Taleo Web API to get data from the external Taleo database and make nodes from this data. This works great.

But now I want to run this update script every night... The script works great whem I logged in into Drupal.

What would be the safest way to allow deleting and adding nodes programmatically when logged out?

function taleo_menu() {
  $items['taleo-update'] = array(
    'title' => 'Taleo Update page',
    'description' => 'Taleo Update page',
    'page callback' => '_taleo_update',
    'access arguments' => array('view content'),
        'type' => MENU_NORMAL_ITEM,
  );
    return $items;
}

function _taleo_insert($jobs) {
    foreach ($jobs as $job_object) {

        $node = new stdClass();
        $node->type = 'job';
        $node->title    = $job_object->title;
        $node->language = LANGUAGE_NONE;

        node_object_prepare($node);
        $node = node_submit($node); // Prepare node for a submit
        node_save($node); // After this call we'll get a nid
    }

    drupal_set_message(t('Added %count jobs.', array('%count' => count($jobs))));
    return array();
}


texts: How can I get other content type data in current content type?

texts: I want to put one condition in my template file of contenttype1. The condition is if contentype2 contains a field value X then I want to print one block in contentype1. So how can I get contenttype2 field values in contenttype1 template file.  To get more clarity, with the contentype2 fields I am creating a views block. I want to display that block in contentytype1 template file. So I want to check a field condition of contentype2. If that field has any value then only I want to display that views block in contenttype1 otherwise it should not display. Thanks in advance for any suggestions.


texts: What are "Text format" option in standard Drupal?

texts:
I would like to know if in Standard Drupal, the comment form allows you to select a text format such as "Full HTML", "Plain Text" and "Filtered HTML" when commenting or even posting an article?

I have installed some module like WYSIWYG, CKEDITOR,IMCE, .., so now I am confused and do not know if the reason I have the option to select format text when commenting is because of the modules that I have installed or not?


texts: How to get a value from block configuration's form control?

texts:
I'm new to drupal stackexchange and drupal too.

I have made an example module that creates a block called "example". I added a textfield form control to the "example" block's configuration page using the hook_block_configuration hook function. Now I'm trying to get the value from the block configuration's form control in my hook_block_view hook function.

Here is what I have so far:

function example_block_info() {

    $blocks = array();

    $blocks['example'] = array(
        'info' => t('example'),
    );

    return $blocks;

}// end function

function example_block_configuration($delta = '') {

    $form = array();

    switch($delta) {

        case 'example' :

        $form['text'] = array(
          '#type' => 'textfield',
          '#title' => t('Text'),
          '#default_value' => '',
          '#size' => 50,
          '#maxlength' => 100,
          '#required' => true,
        );

    }// end function

    return $form;

}// end function

function example_block_view($delta) {

    $block = array();

    switch($delta) {

        case 'example' :
            $block['content'] = get_block_content(),
            break;

    }// end switch

    return $block;

}// end function

function get_block_content() {

    return /* textfield form control value */

}// end function

I figured I have to use the hook_block_save hook function to get the value from the '$edit' argument and store it somehow, but I'm not show how, or if that's the correct way to go about it.

function example_block_save($delta = '', $edit = array()) {

    switch($delta) {

        case 'example' :

            $edit['text'];

            break;

    }// end switch

}// end function


texts: Ternary operator not evaluating checkbox values

texts:
I am using Drupal 7. I have created a form using the Form API, in which I defined several checkboxes. The form sends its contents in an email and this works fine at the moment as long as I simply output the values of the fields, with the checkboxes outputting the value if checked (e.g. Elderly) and 0 if not. In making up the body of the email I want the zeros to be omitted and only the values of the checked boxes to appear. I have tried to achieve this by using a shorthand ternary operator to include some html if the box is checked and not if not. I can't get this to work. Here's how I've defined the checkboxes in the form itself:

$hometypes = array(
            'Elderly' => t('Elderly'),
            'Disabled' => t('Disabled'),
            'Council tenant' => t('Council tenant'),
            'Home owner' => t('Home owner')
            );

        $form['personaldetails']['survey']=array(
            '#type'=>'checkboxes',
            '#title'=>t('Please indicate your situation by ticking the appropriate boxes'),
            '#description'=>t('You can tick a box by clicking on it once'),
            '#options'=>$hometypes
            );

Here's where I set up the variable $elderly:

$elderly = $form_state['values']['survey']['Elderly'];

And here's the section of the submit function that is not working:

  .($elderly == 'Elderly' ? 'Elderly

 	 ' : '').

This returns the 'True' value regardless of whether the box is checked or not. If I change it to be:

  .($elderly <> 0 ? 'Elderly

 	 ' : '').

it returns the 'False' value regardless of whether the box is checked or not.

This may be a bit of a newbie question, but that's because I'm a bit of a newbie! Any help gratefully received.


texts: Select address functionality during checkout for Drupal Commerce 2.x

texts:
I am using Drupal Commerce 2.x for my e-commerce website. I have installed the Address module which provides functionality for storing, validating and displaying international postal addresses. I've added the field for the address in the user registration form through which I can accept multiple addresses from the user.
As per the default checkout flow, the user has to mention his address manually while entering shipping details. So, is there any mechanism where the user can select the address previously set by him? Or I have to rely on customisation to achieve this functionality?


texts: How to properly add anchor to form element

texts:
I try:

         $form['field_profile_club']['anchor'] = array(
           '#value' => '',
         );

But my field (field_profile_club) disappear.

Could somebody help?


texts: how Drupal refresh/rebuild its route automatically after route programmaticaly created?

texts:
I try to understand how Drupal Core rebuild the route automatically after route created programaticaly.

here is one example that i tried: I'm installing External Entities Module.
this module will allow you to create entity and generate its route automatically.

question: how is this possible? what trigger Drupal core to rebuild the route?

i did stack trace on entity form-save action as follow: (to understand what's triggered route rebuild)

KernelDesctructionSubscriber.php line 48 --> public function onKernelTerminate(PostResponseEvent $event)
ContainerAwareEventDispacther.php line 111 --> $definition['callable']($event, $event_name, $this);
HttpKernel.php Line 84 --> $this->dispatcher->dispatch(KernelEvents::TERMINATE, new PostResponseEvent($this, $request, $response));
StackedHttpKernel.Php Line 32 --> $kernel->terminate($request, $response);
Drupal Kernel Line 634 --> $this->getHttpKernel()->terminate($request, $response);
index.php Line 22 --> $kernel->terminate($request, $response);

if you see KernelDestructionSubscriber in specific on: onKernelTerminate

public function onKernelTerminate(PostResponseEvent $event) {
    foreach ($this->services as $id) {
      // Check if the service was initialized during this request, destruction
      // is not necessary if the service was not used.
      if ($this->container->initialized($id)) {
        $service = $this->container->get($id);
        $service->destruct();
      }
    }
  }

when the ID equal to drupal.proxy_original_service.router.builder then it goes to: container.php : initialized method below:

  public function initialized($id) {
    if (isset($this->aliases[$id])) {
      $id = $this->aliases[$id];
    }

    return isset($this->services[$id]) || array_key_exists($id, $this->services);
  }

it will return TRUE because $this->services[$id] is set

and then it will trigger: $service->destruct() in onKernelTerminate then rebuild the route.

the question is where in the External Entities code that will make $this->services[$id] is set then trigger rebuild route?

i've been spending quite sometime and still unable to crack this...

Thanks in advance for the help


texts: Implementing Taxonomy hierarchy in View and Search

texts:
I am working on a biology website that needs to make use of Drupal 7's Taxonomy system, for a biological taxonomy.

My goal is to allow users to tag all content with related species information, and provide the following functionality:

Display all nodes that are associated with a child term of the
specified taxonomy term (so if they access the "Birds" term,
"sparrow" would be included)
Include taxonomy terms in search
Allow for species nicknames, (synonyms), abbreviations and variations in spelling or singular/plural usage

I have installed the Hierarchical Select module, but am not sure it is working correctly. Or, I am not using it correctly. When I insert new terms deep in the hierarchy, they sometimes end up at the top level. There have also been intermittent errors showing in a red box. I'll add that to this post if it shows again.

Example taxonomy

Animalia
- Chordata
-- Aves
--- Passeriformes
---- Passeridae
----- Passer
------ Passer domesticus (primary species term)
------- Common sparrow   (synonym)
------- English sparrow  (synonym)
------- House sparrow    (synonym)
------- ENSP             (synonym/abbreviation)
------- House sparrows   (synonym/plural)

In the above example, I need users to see English Sparrow content when they view the Taxonomy page for Aves, as well as the Taxonomy page for "ENSP" if the node has been tagged with Passer domesticus or any of its child terms.

Ideally, a basic search for any of the child terms for Passer domesticus would also return a list of nodes tagged with any of the term's siblings.

I am open to configuring a View for this, if Search is not possible.  All advice is appreciated.

Similar questions from others:
http://drupal.org/node/1792256

How to have parent taxonomy terms include their children terms' nodes?

How to show the parent and child taxonomy term?

https://stackoverflow.com/questions/5910071/views-show-child-taxonomy-terms


texts: What are the 'todos' when your database is hacked?

texts:
I want to plan for the terrible nightmare of my database being stolen. I feel I am secure, and I am not holding much actual data, but... if it does get taken - what do we do, is there a standard way of drupalists to respond?

I am looking for specifics where obviously required, e.g. 'reset all passwords', but how?

Paul.


texts: Creating line item of specific type programmatically

texts:
Is there a way to create a line item of specific type (different from the default "Product" type) programmatically? The function commerce_product_line_item_new()creates a line item of type Product. I can't find a function that let's you specify an existing line item type other than the default Product one.

EDIT: Never mind. I just realized that the commerce_product_line_item_new() function has a $type parameter that defaults to Product. Not sure how to delete the question, but maybe it will help someone else.


texts: How can I prevent Boost front page cache being cleared on logout?

texts: Drupal 7, Boost 7.1.beta1, cache_expiration 7.1.alpha3 - Boost seems to work for the most part except that the boost cache is cleared too often for the front page (other pages too, but less frequently than the frontpage). Noticeably, whenever I log out from admin (and I'm redirected to the frontpage) the boost cache tag in the frontpage's page source is updated, meaning the frontpage expired and a new one regenerated. I don't have any exceptions in the boost configuration so all pages should cache and I have boost's maximum cache lifetime set for html to 4 weeks, everything else is set to 1 day. Drupal Core anonymous and block caching are off. Cron runs every three hours. I notice the frontpage gets re-cached about every hour (and of course on logout). As I mention other pages stay cached relatively longer but never respecting the 4 week max lifetime (usually a day or less). I don't see any updates/new content on front page (and def not on other pages) for expire to trigger. Possibly a nws weather widget triggering expire? I'm fairly new to drupal and boost. Thanks for any help, suggestions.


texts:
When I do a search, I got an empty result even though the result shouldn't be null.
I even get a null result if I don't filter anything. However fulltext search works, only facets corresponding to a field seems to not work.

I copied a production database to a test server. Everything works fine on production, but I can make the test copy works.

I've seen there is some issue with facets if the user doesn't have the permission to create temporary table. I checked that, and I think I have the permission.

Any idea ? (I use drupal commerce)


texts:
I have some problems with files. Everyone is talking about admin/content/file, but I just don't have the link under /admin/content, and going to the url by hand returns me to admin/content.

I seem to be pretty much up to date (drupal 7.50, file_entity 7.x-1.5) and media is working (it's just buggy in strange ways).

Where should I look to find why the link is not showing under /admin/content ? Iow, who should be providing the view ? That would give me a clue.


texts: How can I use a Twig if statement in a View rewrite

texts:
How can I add a Views field rewrite using Twig that will display the moderation state only if the node is in draft state or review state? I tried the code below but it prints all of the moderation states.

{{ title_1 }}
{% if field.moderation_state == 'draft' %}Draft{% endif %}

This is how my list of titles look:

page1 Draft
page2 Published
page3 Submitted

I want all of the page titles to always display. I never want Published to display. So I want to first check if the moderation state is equal to draft and review.

I also tried variations like this

{% if moderation_state__value == 'draft' %}

Below are the available replacement pattters

   {{ moderation_state }} == Moderation state
   {{ path }} == Link to Content
   {{ title_1 }} == Title
   {{ title_1__value }} == Raw value
   {{ arguments.nid }} == Content: ID title
   {{ raw_arguments.nid }} == Content: ID input


texts:
i am using pressflow 6.25
 there is a flie views-view-field--events--block--field-date-value.tpl.php  in template theme directory

in line 5

$create_date = explode(' ',eregi_replace('<[^>]*>','', $output));

in my web site
show this error
Unknown error: Function eregi_replace() is deprecated in include() (line 5 of C:\xampp\htdocs\fiddle\sites\all\themes\sttheme\fiddle\templates\views-view-field--events--block--field-date-value.tpl.php).
how can i solve my problem?


texts: How can I stop full page HTML from being cached?

texts:
I am having an issue with my whole page's HTML being cached. This is getting in the way of some dynamic block content that is based off of a user preference value (both authenticated and anonymous users).

I have located the cache entry in the cache_render table of the DB and it has a CID of:

http://dev-mysite.pantheonsite.io/:html

(this would be the entry for the front page)
I do have the block that builds this dynamic content configured with cache settings:

[#cache]['contexts'] = ['session', 'user'];
[#cache]['max-age'] = 0;

I am only having this caching issue when code is push to the Pantheon servers, local development environments with default cache config settings do not have this issue.


texts:
I installed "Form block" and it creates blocks. I want change block title via my module, but it doesn't work.

I create module and set function with hook_block_view:

function zzz_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'user_register':
      global $user;
      // Don't display the form to logged in users or if registration is disabled
      if (!$user->uid && variable_get('user_register', 1)) {
        $block['content']['form'] = drupal_get_form('user_register_form');
        $block['subject'] = t('MY TITLE IS HERE');
      }
      return $block;
  }
}

What did I do wrong?


texts: No front page content has been created yet in front page

texts:
I have used page--front.tpl.php for creating my front page. In my footer it displays the message No front page content has been created yet. I have used solution specified in Removing the "No front page content has been created yet." message from the front page to hide the message

Is there another way to hide the message. Thank you


texts: Two Blocks for sort filter Views -- Drupal 7

texts:
I have a view in Drupal 7 with results including a field of date and another with price, I need to sort the results by means of these two fields when I click on the appropriate link (not button or dropbox radio), but the trick is I need add the different sort filter into two separate blocks, because each block will have a different per user context.

Besides the filters should be links. Any idea how to work this?


texts:
I want to know where Drupal (or its modules) create temporary files. Are they put in sites/default?

I'm especially talking about Drupal 6.


texts: How to have a dialog box displayed automatically when a page is reached without having to click the link?

texts:
Using Dialog API and advice from @leymannx, I added this link to a node (node99):

Last minute information

and it works fine: when clicked, the dialog box shows up!

Now, I'd like to have the dialog box displayed automatically when the node is reached without having to click the link.
@No Sssweat suggested to make jQuery to click the link for you on page load $(".use-ajax").click();

After some errors ($ is not a function), I finally used this:

(function ($) {
  $('.use-ajax').trigger("click");
})(jQuery);

It works but not as expected: the node 27 (the link has href="/node/27") is displayed instead of node99, not in a modal over node99.
What am I missing?


texts:
I have a piece of code that I want to have the default value be a variable, but I need to know how to set a default value if the variable is not set:

  $form['background_audio_height'] = array(
'#type' => 'textfield',
'#title' => t('Subject'),
'#default_value' => variable_get('background_audio_upload_path'),
'#size' => 5,
'#maxlength' => 3,
'#required' => TRUE,
);

How can I set a default value if background_audio_upload_path is not set?


texts: How to add custom badges depending on the amount of User Points earned?

texts:
In my website I have the Vote Up/Down module and the User Points module enabled and a rule (using Rules) to add user points for every vote automatically.

What is the way to add Custom Badges depending on User Points?

Let's say, if a user has 100-150 user points then the user's badge will be "Newbie". If the user has 150-200 points then the badge will be "Regular" and continues...

I have tried with the Achievements module but it seems difficult!

So what is the way to add custom badges depending on User Points?


texts: Custom login block that redirects to password protected page that is not published otherwise

texts:
I realize that there are many ways and modules to accomplish this with, but this is the one particular way I need it and I'm having trouble finding a good solution. So here is what I'd like to achieve:

A custom block on a page with username and password fields. After entering the right combination (it'll be just one pair probably), the form would redirect the visitor to a content page that is unpublished.

Logged in visitors should not be Drupal users, nor should they go through a registration process. Certain people will know the right user/pass combo and only they should be able to access the protected page.

The Protected Pages module doesn't create a login block, password input only possible on the actual page that is protected.

I tought about creating a custom module with a form that would redirect after entering the right user/pass combo, but if the destination node is unpublished, it won't work anyway.

Do you have any good ideas for this one?

Thank you,
Bálint


texts: Hide Block on Particular Page with Bootstrap

texts:
I have a block called 'calendar' that I display on all events pages. events* such as events/today/, events/all/ etc.

A constraint that I have is that the block must be displayed on all events pages but on one particular page. The block must be hidden when the user is using a mobile device.

My thought process was to simply apply the bootstrap 'hidden-xs' class to the block. But the constraint is not satisfied as it would trigger on all the events pages.

What would be the easiest way to implement this?

Thanks in advance.


texts: get to previous page with destination d6

texts: For example i have a button which has onclick event (redirecting to a user login page). When a user clicks on that button browser redirects him to page user/login, but when he's successfully logined in - how to redirect it back to the previous page? Tried module login_destination, but didn't worked for me..


texts: Optional configuration and order of enable modules on profile

texts:
I have a bug or a misconfiguration I don't understand. I'm creating a profile to create new web sites with an advance configuration quickly. But I meet a bug during installation with dependencies of with some configurations.

On image style, I add a manual `crop type than I add on the majority image style. For example, my file for image style large is:

langcode: fr
status: true
dependencies:
  config:
    - crop.type.crop_1x1
  module:
    - crop
name: large
label: 'Large (480×480)'
effects:
  ddd73aa7-4bd6-4c85-b600-bdf2b1628d1d:
    uuid: ddd73aa7-4bd6-4c85-b600-bdf2b1628d1d
    id: image_scale
    weight: -9
    data:
      width: 480
      height: 480
      upscale: false
  7cd03233-541d-472e-851c-de8945ee6709:
    uuid: 7cd03233-541d-472e-851c-de8945ee6709
    id: crop_crop
    weight: -10
    data:
      crop_type: crop_1x1

I put all images style configuration file in the directory optional in config directory. My configuration files for crop and the crop type are in the install directory. Despite this, when I test my installation, I have always the error message :

  Drupal\Core\Config\UnmetDependenciesException: Configuration objects provided by image have unmet dependencies: image.style.large (crop.type.crop_1x1, crop) in Drupal\Core\Config\UnmetDependenciesException::create() (line 98 of /var/www/html/core/lib/Drupal/Core/Config/UnmetDependenciesException.php).

I have no configuration which are dependent of image module in install directory. Image module is always enable before Crop module instead of to respect dependencies. I tried to put my configuration files for crop in optional but it doesn't fix the problem, I don't know if change the order of modules in dependencies of my profile have an influence. I try without success.

I don't see where is the error in my installation.

Update: This problem happens only with default configuration of image module, that is image.style.large, image.style.medium and image.style.thumbnail which are the native configuration. I have other styles which are import later, after crop module is enable and configure as expected. I don't know if it's a bug of the configuration manager which try to import necessary default configuration files even if they are in optional.


texts: How do I use Panels to replace a default node page?

texts:
In my Drupal 7.8 installation, I have defined a custom content type "Reviews" which has several fields. Instead of displaying the normal Reviews page for every review, I want to display a panel layout with the fields stuck in different panel regions. I have absolutely no clue how to begin doing this, and I couldn't find any simple instructions.

I have Views, Panels, and CTools modules already installed.

Thanks!


texts:
I want to exposed date filter option
but am getting just textbox instaed of datepicker
I have installed date module still am not getting following options:

installed modules are as shown bellow:

Please guide me how to set datepicker and add search option using that?