texts:
I want an overview of articles sorted by their post date (some articles will be posted back in 2007). But then the possibility should be there to move an article back to the top of the list (we want to recycle old content). We don't want to change de post date manually, because this is valuable information (so the post date should be the original post date), I also don't want to use the updated date, since sometimes you'll need to edit a node without having it move back to the top of the list.

I was thinking, Weight module, but maybe there are better alternatives, i don't need as much control on the sorting as the weight module is giving.
I'm not afraid of creating (small) custom modules, if i'm properly guided through the Drupal API.

Ideally i'd want:
1. an action 'move to top' on the content overview page and a simple checkbox on a node edit page: move to top.
2. an action and checkbox that says: reset to post date, so that we can put it back in the order it's intended to be...

I was thinking a date field, that gets updated to now() every time the 'move to top' action is called... and is emptied when 'reset to post date' is chosen...

Does anyone know a module that does this? Or can guide me in creating it?

Kind regards and thank you in advance

The workflow i'm going for:

Enable custom module (i know how to create a module and activate it)
Add option in each node type I wish to have this function (maybe in the publishing options, simple checkbox should suffice)
In a node have a checkbox 'Move back to top' and 'Reset order'. Both should then edit a extra node field timestamp (*remark at the bottom). The checkboxes should not be checked when re-editing the node, since it is more of an action (it's difficult to explain, but I think it should be clear what i'm trying to say)
Have this extra date field available in views

*Remark: I read somewhere you could actually add a field to the node table itself, I think it was with schema_alter hook. If the timestamp is in this table, the query's would be faster then when it's in an axtra table (which would mean an extra join)

edit2: Went for a custom module with views, operations and actions integration.
The module is finished, maybe i'll make it public. Does anyone think this might be interesting for others?
How does this module uploading work on drupal.org?


texts: How to show both currencies at once in the node page for price field

texts: I am using Drupal commerce kickstart, Here I have two types of currencies like $ and INR. In the node page I am showing INR currency by default. Using Curreny Selector Module I am showing Dropdown to select the currency. If currency selected by user then calculated $ currency is showing fine. But here I need to show both prices at once. For example, "Rs.1205 & $20" at once without selecting the currency from dropdown. I am loading this node page programmatically. So I want to load the currency programmatically which is converting through European Bank. Any Suggestions please.


texts:
I want to create another login page, for example www.example.com/user-admin. But without deleting the existing one.

Or, as an alternative, I want to be able to display the login forum anywhere.

How can I do that?


texts: Does $element['#title'] need to be escaped with check_plain()?

texts:
I see (with grep) that the value of $element['#title'] in a render element is sometimes sanitized with check_plain(), and sometimes printed unfiltered.

Which one is correct? Is the value considered safe to print? Or does it depend on the theme hook?

Examples from core:

modules/field/field.form.inc
314:        'data' => '<label>' . t('!title !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>",

(notice the "!" in the placeholder, this means that format_string() will not escape the placeholder value)

modules/field/field.module
1052:  $variables['label'] = $variables['label_hidden'] ? NULL : check_plain($element['#title']);

This question applies in both ways:

When setting $element['#title'] in a render element.
When printing the value of $element['#title'].
When printing a $variables['title'] value that was extracted from a render element property.

Note: Very often the $element['#title'] property comes directly from a t() call.


texts:
In my content type I have a thumbnail where I put the link to the image I want to embed into a view.

For the fields I have
Content: Title [hidden]
Content: Thumbnail

In views for the Content: Thumbnail I check "ReWrite Results" and add

{{ title_1 }}

This displays the YouTube thumbnail in my view. The problem I am having is trying to make it so the user can click on the thumbnail to get to the content instead of having to click on the title which I display below.

I know twig can be used in the "Rewrite Results" but I wasn't sure what to call in there to add it to an href tag


texts: exposed filter autocomplete suggestions sort

texts:
I have more than 10 terms in vocabulary: car, red car, blue car, yellow car etc.
I know that 10 results is hardcoded value for autocomplete widget. My problem is that after typing "car", I only get various other terms, simple "car" is not in suggestions.

How does the autocomplete widget work?
Is there any way how to sort/alter results? Why it does not show the exact term first "car" and then all other terms containing "car"?


texts: Custom install profile fails at creating folders

texts:
I have a relatively simple custom installation profile for Drupal 8.
All it does is:

Ask for the sites domain name and the name of the theme it should scaffold.

Use the domain name to create the proper multi-site folder in /sites/<domain-name>
Use the theme name to create a theme folder under the multisite folder: /sites/<domain-name>/themes/custom/<theme-name>
Copy the relevant example files to the domain and theme folder, from the default site.

The problem I'm having is that it fails at creating the folders, due to it not being permitted to create the folders.
The /sites is set to permission 0755, and the problem is only fixed if I set sites to have permission 0777.

The folders are created using PHP's mkdir() function, as is set to create the folders recursively.

Questions:

Is there a better way to make folders during installation, than using php's mkdir(), that would fix my permission issue?
My assumption would be that the script (drupals installation UI) is being run as a different user than the one who owns the folder/filers of the site (installed via cli git and composer). How to I check which user the script is being run under? (using apache2 on centos7, in case it is relevant)


texts: Add custom class to views row depending on field value

texts:
I'm using views to show different fields of an entity. If the uid of the entity is the current user I would like to add a custom class to the entire row (not only to the field).

I wrote the following preprocess function that works fine if I use the entity in views, but I don't know how to change it when I use fields instead:

function my_module_preprocess_views_view_unformatted(&$variables) {

  $view = $variables['view'];

  if ($view->id() == 'my_view' && $view->current_display == 'page_1') {

    $rows = $variables['rows'];
    foreach ($rows as $id => $row) {

      $uid = \Drupal::currentUser()->id();

      $owner = $row['content']['uid']['#object']->get('uid')->getString();

      $class = ($uid == $owner) ? 'own' : 'other';

      $custom_row_class = 'views-row-' . $class;
      $variables['rows'][$id]['attributes']->addClass($custom_row_class);
    }

  }
}


texts:
I'm trying to develop an script to upgrade nodes with a term reference.

But my source has 3 columns (copy to an in a db table) to the term tree, example:

fieldnames: ref1, ref2, ref3
fields: CAR -> REDCAR -> DARKRED

I can't use term name because it has is duplicates on the tree. Example:
fields: CAR -> REDCAR -> DARKRED
fields: BIKE -> REDBIKE -> DARKRED

How to get the right TID and verifying the tree with my DB table?


texts: Left Join query causing 'Column not found' error

texts:
In Drupal (v7.22) I'm trying to modify a query in a module so that it checks the value of an additional field from another table while looking for a result. I've been going through the documentation but cannot seem to stop my version causing an error. The original working code was:

$result = db_query("SELECT nid, type FROM {node}
WHERE type IN (:type) AND LOWER(title) = LOWER(:title)",
array(':type' => $node_types, 'title' => $page_name,));

I've then added in a left join:

$result = db_query("SELECT nid, type FROM {node} AS entity_id
LEFT JOIN {field_data_field_test}
AS nid ON node.nid = field_data_field_test.entity_id
WHERE node.type IN (:type) AND LOWER(node.title) = LOWER(:title)
AND field_data_field_test.field_test_value = :test_value",
array(':type' => $node_types, 'title' => $page_name, 'test_value' => $tvalue,));

But it gives the error:

PDOException: SQLSTATE[42S22]:
Column not found: 1054 Unknown column 'node.type' in 'where clause': ...

Any help would be appreciated.


texts:
If I log in as User 1, i see user 1's profile picture. If I log in as User 2, I see user 2's profile picture. As expected. But after browsing a bit, User 2 would suddenly see User 1's profile picture.

This ONLY seems to happen on /forum (i use the standard drupal forum module).

And I use my .theme file to populat a variable as follows:

 $variables['current_user_profile_picture_medium'] = \Drupal::entityTypeManager()->getStorage('image_style')->load('medium')->buildUrl($pp);

Where $pp = public://someOrOtherProfilePic.png

And I use it in my template as follows:

{{ current_user_profile_picture_medium }}

So it would seem that the .theme file figures out it needs to user profile pic A, but then when User B logs in, it still shows pic A.

I think I am missing something about caching here. It would seem the .theme file is only getting the details once. So I went to look what php is being generated and found this:

echo $this->env->getExtension('Drupal\Core\Template\TwigExtension')->escapeFilter($this->env, $this->sandbox->ensureToStringAllowed($this->getAttribute(($context["user"] ?? null), "profile_picture_medium", [])), "html", null, true);

It seems to be getting confused with $context["user"] or not updating it or something.

Can anyone steer me in the right direction? What am I missing about caching/twig/templates?

Thanks!

UPDATE

It seems I might be having similar issues to this.

UPATE 2

Adding this to settings.php didn't help:

$settings['cache']['bins']['page'] = 'cache.backend.null';

UPDATE 3

I tried adding a twig function, but even that remains cached. This doesn't seem to work:

<img src="{{ get_current_user_profile_picture() }}" class="img-responsive" alt="...">

If I put die() in this function, it doesn't hit the die() if the page has already been loaded once.

I'm really stumped....


texts: Hitting the back button after a batch process cause a nasty error

texts:
I have a batch process (using batch API) that runs when a user on my site tries to launch a non signed Java applet. The batch process does all the needed codesigning and other things and then redirects the user to the applet when it is finished. This all works well but if the user hits back from the applet page they get this nasty error with the text from my batch_error function.

It seems that this occurs because when you hit back you end up trying to run a batch process that no longer exists. Is there anyway to avoid this?

EDIT:

Here is my function that sets up the batch process:

function batch_codesign($node) {
$batch = array(
   'operations' => array(
        array('batch_codesign_process', array("create_jar_files", $node)),
        array('batch_codesign_process', array("output_new_agentsheets_applet_html", $node)),
    ),
    'finished' => 'batch_codesign_finished',
    'title' => t('Codesigning'),
    'init_message' => t('Codesigning ' . $node->title .'.'),
    'progress_message' => t('Processed @current out of @total.'),
    'error_message' => t('An error has occured while condesigning the project, please try again.'),
    );
batch_set($batch);
$nid = $node->nid;
batch_process("path/to/endpoint");
}


texts: How to enforce a one-to-one relationship

texts:
I want to store data about students and the books they read. Each student can read only one book, and each book can be read by only one student.

I have created a Student content type, and a Book content type, and I have created a reference field in the Student content type to reference the Book content type, and I have made the reference field to only accept one value:

So this way when I am entering data for a student, I can only enter one book value for the student (so the constraint that a student can only read one book is enforced).

But I can still enter the same book for more than one student, for example I can enter book1 for student1 and and I can also enter book1 for student2. How can I prevent this (remember that I want each book to be read by only one student)? The way I can do that if I am creating a database is to make the book foreign key in the Student table unique, but I don't think there is a way to make a field unique in Drupal.


texts: Migrating Users with Migrate D2D when/if they already exist

texts:
How does Migrate D2D module handle the migration of users if the matching users already exist in the database? I did a user import with MySQL different way earlier, but I want to do it through this module in order to scoop up a few missing pieces, such as the user avatars.

Thanks!


texts: Colorbox isn't working, although all settings are correct

texts:
I'm having a bit of an issue over here. I've installed the Colorbox module like it should (install the library & the module, like described in the documentation), the HTML is generated as it should, but the colorbox module doesn't activate at all...

This is the HTML:

but still, I don't see any colorbox...
Is there something I forgot or oversaw on my install?


texts: Drupal 8 Metatag and Media Entity modules to set meta image tags

texts:
On a Drupal 8 content type, I have a field with an entity reference field to a Media Entity field.  I would like to use the Metatag module to set the image that is on this Media entity in the og:image meta tag.

Featured Image - [node:field_im] - Returns the entity name
Featured Image type with delta 0 - [node:field_im:0] - Returns the entity name
Media - [node:field_im:0:entity] - Returns the entity name
Media ID - [node:field_im:0:target_id] - Returns the entity ID

In Drupal 7, the following token was available:

[node:field-fimg:0:file:url]

But I don't see anything like it in D8.  Could someone point me in the right direction?


texts: Stop displaying content of subpaths for invalid URLs

texts:
I have views set up, with following paths:
www.example.com/news
www.example.com/projects

If a user goes to www.example.com/projects/not-a-url or www.example.com/news/not/a/real/url it displays the content of /projects or /news accordingly.

Is this a core function? I would prefer it to either 404 or preferably redirect completely.

I have disabled Paths, Pathauto, Redirect, and Global Redirect but it still shows the content for the views when it should be a 404.


texts: Drupal Commerce: How to get payment module settings?

texts:
How to programmatically retrieve configuration of the specific payment module?

I tried

$settings = rules_config_load('commerce_payment_MODULE_NAME');

It returns very basic info (name, ID etc) and empty "settings" array.

Cant also get it directly from DB .

It is stored in serialized array that can not be fully processed with the unserialize() function.


texts: how to send $user variable from drupal to another php non-drupal page under same root?

texts:
I have drupal cms and another php site with each own session and db etc on same root.

What I want is to pass somehow the drupal $user variable with all the login details of the user to the other non-drupal php site in order to bypass the login and make the user logged in there too.

The non-drupal site has its own login/register and sessions etc. I want to override this by getting the user info from drupal registration.

require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

I tried to use the above code on the index of the non-drupal site, but I get errors about session and headers that already sent.

Any help?


texts:
How can I implement "click to show" some text data at pages?
Also I need to save log in database about events.

I've found tiny module Field Value Loader (Show field on click).

Any suggestions about how to implement this?


texts: how to get list of field names by select its node type in drupal?

texts:
I got the all node type list in a variable using get_node_type_info() and now am passing this variable to field_info_instances as:

array_keys(field_info_instances("node", $op_keys));

ps: $op_keys is the variable to get node types.
But this is giving me list of node_type "keys" and I want field "keys".

Either tell:

  (1)how to pass list of all node types as a $bundle_name in
  field_info_instances() ?

or

  (2) when selecting any of the node_type (as an option of select
  list) from select list, it's corresponding field's name will get
  rendered. I mean to say for example: node_type = "Article" and its
  field names  = "body", "title", "image". when "article" got
  clicked from select list, "body", "title", "image" should get
  rendered.


texts: How to resolve the error when adding an entity reference relationship?

texts:
Multifield Contributed Module - https://www.drupal.org/project/multifield

Company Content Type has multifield

1) Company Division - Entity reference
2) Company Categroy - list

While adding relationship as entity reference node company division in views an error is thrown.

  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_fieldname_node.id' in 'on clause'


texts: Rebuild form is not working in #ajax callback

texts:
I've tried to build a form with #ajax submit function and rebuild the form. The following is my code.

function campaign_new_form($form, &$form_state){

 if(!isset($form_state['num_names'])){
   $form_state['num_names']=2;
 }

 // Create wrapper for ajax
 $form['#prefix'] = '
';
 $form['#suffix'] = '
';

 for ($i = 1; $i <= $form_state['num_names']; $i++) {
   $form['name_' . $i] = array(
     '#type' => 'textfield',
     '#title' => 'Value ' . $i,
     '#required' => true
   );
 }

 $form['add_button']= array(
  '#type' => 'submit',
  '#value'=> 'Add more',
  '#ajax' => array(
    'callback' => 'campaign_new_form_callback',
    'method' => 'replace',
    'effect' => 'fade',
    'wrapper' => 'form-wrapper',
 ),
);

 return $form;
}

function campaign_new_form_callback($form, &$form_state){
  $form_state['num_names']++;
  $form_state['rebuild'] = true;
  return $form;
}

It always renders two fields. What is the problem in my code?


texts: I have a content type called Profiles. Each profile has two filters, one is Location (East side or West Side) and the other is floor (2nd or 3rd). In the view I have set the profile to filter by location and floor. There is an employee who has an office on both the 2nd and 3rd floor in the east side and the 2nd floor on the west side but NOT on the 3rd floor in the West Side. But in the content filter I enabled all fields without thinking on one exception. How do I take care of this exception, please help


texts:
I'm hitting a blank, I need to be able to offer a print option on some views (a pdf) and not on others.

Does anyone have an elegant way of doing this?

Thanks for looking, I appreciate your time.


texts: Saving values of a multistep form into custom entity fields

texts:
I'm building a module that implement a multistep form based on a custom entity.
The entity contains fields which are created by the install file.

I was able to create the steps and if I print the $form_state[storage] array in the last step I can see all the values entered all along the form.

But when I submit the last step the entity is empty.
This is what I have in the last_step_submit:

$organisation = entity_ui_form_submit_build_entity('organisation',$organisation, $form, $form_state);
$organisation->save();
drupal_set_message(t('The organisation: @name has been saved.', array('@name' => $organisation->name)));
$form_state['redirect'] = 'admin/organisations';

I know that I'm missing something but really I can't figure out what.
I'm quite new in module developing and I'd appreciate any help.


texts: Content Field Type Image not auto resizing

texts:
I am fairly new to Drupal, I am currently working through Tom Geller's excellent video series on Lynda.com. All is going well, except I am having a problem when trying to set display properties for any content types containing an image field. If I keep the display settings for the image field as the original image then it will display. However if I try to set an image style for example to use as a thumbnail for a teaser, the image does not show. In Chromium there is an empty frame of the correct size but the image does not display. In Firefox only an empty space is shown where the image should appear.
I am running my site on a local Apache server which contains multiple sites, and the issue occurs in all the sites. I have the most recent stable versions of Apache, PHP and mySQL. I have come across other threads on various sites where people have had this issue however their fixes have not worked for me. I'm sure its simple fix but its been bugging me for hours!
Thanks in advance,
Jackson


texts: How to change File field icons (without changing core)?

texts:
The generated markup for displaying a file field is (PDF in this example):

<img src="/modules/file/icons/application-pdf.png" title="application/pdf" alt="" class="file-icon">

I'd like to use a different icon image. How could I do this without changing the content of /modules/file/icons?

I guess I could hide the default image and display a different one with CSS, but seems a bit messy.


texts: Devel themer not working (cant see the checkbox)

texts:
I want to see from where different elements are coming from. Theme Developer module does this, but I cannot see the checkbox in the lower left of  the page. It was working earlier but it isnt now, i am using drupal 7.

Anyone seen this issue?


texts: Entity Reference View Widget problem with add selective

texts:
I am using a content type which uses a field as "Views" Entity Reference View Widget. When I click "add selective" or "add .. and close" in form of this widget, it's just redirect to http://localhost/denwer.

How do I solve this problem?

Thank you for answer, kiamlaluno.

details of question:
1. I create a view with type display "Entity Reference View Widget" as table of taxonomy term
(after create view in this view besides display name of views "Entity Reference View Widget" no more information that it use "Entity Reference View Widget" - in Format just show that it's table (grid etc..)
2. Create content type
in content type create field:
- type filed "Entity Reference"
- widget "view"

after create field in description of module "Entit.. widget" says that "on the next page select your View from the dropdown" but there is no dropdown in which can choose my view (picture below)

if just click "save" created view chosen
(picture below)

then i use default settings and save settings of field.

Next step  - Add node of created type and here is problem:
- i see field with widget, can click add item
- then i see "widget form with created view"
But if click on buttom "add selected item" - it's just go to page "/localhost /denwer"
and of cause nothing add in "node add"


texts: I am developing a Mobile App for my drupal website, where user need to login with existing user account in drupal. How to validate password? I have tried MD5, and also concatinated it with $S$. Any suggestions..


texts: Add field formatter settings to all field formats

texts:
I would like to be able to modify the display of any field formatter. To to this I think the best approach is to add settings to all field display formats. Alternatively, I could create my own field formatter that applies to all field types and then show the default display formats within my own display settings.

For example say I want to have a field display settings checkbox that enables a div around the display of any field.


texts: What is the best way to add the latest version of jQuery to a theme?

texts:
This is just a simple question I have. I'm most interested in seeing what others are doing to use the latest version of jQuery in themes.

The reason for this is that some of the best jQuery plugins I use require much later versions of jQuery than what Drupal comes with.

I have tried the update jquery module but it is not as good for Drupal 6 sites.

Is there another way outside of adding your own version of jQuery. Then once you have it finding and replacing jQuery with something like myQuery and sticking myQuery.noConflict() at the end? And then once this is done rewriting plugins to work with myQuery?


texts: Views to Recognize my Custom Entity's One-to-Many Reference

texts:
I have a drupal 8 custom entity and have it referencing another custom entity of a different type. It is a one-to-many relationship like a department with assets. It won't recognize the assets relationship (but it will recognize the one-to-ones). How do I make that bridge in my EntityViewsData extended class so that I can use assets in the Relationships section of the Views UI? I have scoured the docs and core entities and cannot find the answer.

More info: The department has a base table 'department' and another table 'department__assets' that the reference created. 'department_assets' has a field 'entity_id' that connects the table to the department and a field 'asset_target_id' that connects the asset table. The assets base table is  'asset'.


texts: How can I change the 'type' of Drupal script tags from text/javascript to text/plain?

texts:
I could use some assistance in figuring out a way to change script tags for a Drupal 7 site to be "text/plain"  instead of "text/javascript" And additional attribute(s).  I can tell already that script injection is something that is all over the board when it comes to implementation. Facebook 'pixel' for example is injecting script code outside of the drupal_add_js mechanism. And there are plenty of script tags added in templates (which are simple to change as necessary) but I would like to come up with a solution for the actual Drupal injected scripts, and nothing I’ve tried has worked yet.

Reasoning

This change is required by the service provided via https://eucookie.eu/ for handling GDPR related functionality.  I technically only need to change scripts that are adding cookies.

What I've tried without success

Implementing hook_js_alter() in a module

This provides access to some script information, but I don't see a way to change the script type attribute at all.  I can however add attributes, just not alter the type as necessary.

Implementing phptemplate_preprocess_html_tag

mytheme_preprocess_html_tag(&$variables) {
  if ($variables['element']['#tag'] == 'script') {
    $variables['element']['#attributes']['type'] = 'text/plain';
    $variables['element']['#attributes']['data-cookie-if'] = 'analytical';
  }
}

The additional attribute of data-cookie-if IS being added as expected.  But the type is not being changed, in fact, there is no type at all in the resulting markup.

Additional complications

Script Aggregation if enabled will add another twist, and I'm fairly certain I will need to disable this, but still wanted to mention in case there is a preferred workaround.


texts: Change entity.field.FieldFormatter for a custom view

texts:
For an Product entity I’m added custom field "images" // it contains all product images.

To display these images, CustomFieldFormatter is used, it is specified/set on the entity type "manage display" settings page.
So each time the entity is rendered, it uses that CustomFieldFormatter, which display grid of images, with on hover and other effects.

But now I want to create a view to display grid of products (catalog page)
and display only one (first) image of each product entity.

Please, help me find a way to change FieldFormatter for my field when it is shown inside "catalog" view. Or maybe there is some better architecture/solution?


texts: How do I extend a configuration form without using hook_form_alter()?

texts:
I want to extend some fields in a config form of a module with another module in Drupal 8. I created a config form in a module (e.g. custom_1) and now I want to add some more fields from another module (e.g. custom_2). custom_1 has a dependency on custom_2. I tried hook_form_alter() but it didn't resolve the issue.

Is there any other way to achieve this in Drupal 8?


texts: hook_file_download triggered twice on Firefox

texts:
I'm using a clean slate Firefox Quantum 63 testing my Drupal 8 website. It is well working on Chrome and IE but Firefox fired twice on hook_file_download API (some nodes automatically created twice). Any idea why this happened?

my hook looks like this:

function hook_file_download($uri) {
    $node = Node::create([
        'type'    =>  'article',
        ...
    ]);
    $node->save();
}


texts: Can I search Taxonomy terms within display suite

texts: I don't think so, but I'm throwing it out just in case I am incorrect


texts:
Is there a working module for Drupal 7 to restyle admin/people/permissions/list to add more usable controls? Some serious boons to building a large site with lots of permissions:

Incremental search/filtering of shown permissions
Add/Remove/Toggle all permissions for a role (globally, or per module — one column, or part of a column)
Grant/Revoke/toggle a permission to all roles (one table row)
Collapsible/tabbed groups

Something like Module Filter, but meant for permissions administration, would be ideal.

I've tried a couple of modules, but haven't had much luck with them. E.g. the stable version of Permission Select from 2009 (!) fails to do anything, while the development version at least adds its checkboxes (but clicking on them does nothing).

Short of writing my own module and/or hacking something in jQuery, is there some understated gem of a module out there I should be using for this?


texts: What is the difference between "Limit allowed HTML tags and correct faulty HTML" and "Correct faulty and chopped off HTML"?

texts:
In CKEditor Filter processes (/admin/config/content/formats/manage/filtered_html) there are filters.

If you use "Limit allowed HTML tags and correct faulty HTML" do you still also need the other one, or does this one do all that, plus limit?


texts: How to reduce the memory used by a site with many domain aliases

texts:
I have a Drupal 7 site which runs on a Centos 6 x64 server with 4GB RAM, Apache, Memcache and Opcache.

The drupal site has a base domain 'example.com' and 2000 domain aliases (parked domains) which each point to its own landing page in the same website (sales pages).

The .htaccess contains one rewrite rules that includes the domain name as variable (without the dot) in the url. In that way the parked domains each show their own node. The rule is as follows:

  RewriteCond %{HTTP_HOST} !=example.com
  RewriteCond %{HTTP_HOST} (.+)\.(\w+)
  RewriteRule ^/?$ ?q=landingpage/%1%2 [L,QSA]

With the 2000 aliases, the memory is insufficient and the server
becomes unresponsive.
Without aliases, the website uses approx. 500MB RAM.
The maximum number of aliases appears to be around 500, with the
server still functioning normally.

I think (but I'm not sure) that Memcache stores all aliases as complete separate websites, while it should only cache the codebase once.

I would like to optimize the memory usage with regard to the domain aliases, so that max 4GB RAM can be used. As a last resort, I could exclude the domain aliases from Memcache, if that is possible. (I have not found documentation that confirms this.)


texts: I have to remove HTML code that shows up on each page, where is it coming from?

texts:
I am very inexperienced in Drupal.  I have been asked to remove commented HTML code that appears on each page of the website.  What file should I look for in the root directory to find the source of this?

The comment was added by another developer as a joke or something.  It's only wrapped in the body and appears close to the top.

The site is using Drupal 6.


texts: Views taxonomy for multiple content types

texts:
I have three different content types: News, Events and Resources. They all use the same set of taxonomy so that all content is tagged with the same categories.

I want to build a view with the taxonomy terms exposed so that they can be searched by users.

However, I seem to have to add each as a separate field, which looks quite messy.

I've tried a grouped filter, however, no results are found when I know they exist.


texts: How to create an 'Add item' contextual link for views?

texts:
I like the concept of contextual links in D7 and want to push it a bit further: I want views to have an 'Add item' contextual link, so the site administrator can easily add new items.

Of course I could add an 'Add item' button to the view's footer instead. But I need to show it only to users who have the appropriate permission to add items.

Is there an idiomatic way of doing it?


texts: How can i use taxonomy name in url page using a view

texts:
I have a taxonomy terms like:

christmas
wedding

How can I build a view with url page like this: www.site.com/%
being % christmas or wedding,

If users go to  www.site.com/christmas just display nodes with christmas taxonomy.

If users go to  www.site.com/wedding just display nodes with wedding taxonomy.

I have to do n views with same fields that why I want to do just one generic view.


texts: Can you suggest any alternative for Statistics module?

texts:
We have a pretty descend traffic to our Drupal website, approximately 600 page views per minute. We have enabled the Drupal statistics module for storing the node page views.

At peek traffic hours, we observed a high usage of Disk I/O wait, and we doubt that it is due to statistics module. Please correct me if am wrong. If yes, kindly suggest some alternative method to implement node view counter.


texts: How can I add GET parameters to the URL after submitting a form

texts: I am trying to add certain parameters to my URL after submitting a form. I have a module which uses HOOK_form_alter and I am wondering if it is possible to add these parameters to the form so that they appear in the URL when a user clicks to submit the form.


texts: PHP Error occuring when updating, clearing cache or install/uninstall modules?

texts:
I am getting this below error when doing the actions of clearing cache, or install/uninstall module, running update.php.
InvalidArgumentException: Routing requirement for "_user_is_logged_in" must be a string. in Symfony\Component\Routing\Route->sanitizeRequirement()

Can you please help on this?


texts: What is the difference between rendered entity and content in views 3?

texts:
In the Format option for a view, the options include Content and Rendered Entity.

They both offer you a selection of view mode for the content. The former includes some extra options on comments/links.

So what is the point of Rendered Entity if it's a single configuration of Content?

Suspect I'm missing something!


texts: Creating SearchAPI searches without using Views

texts:
I am using SearchAPI on a website with 20,000 entities indexed. Searching through them with SearchAPI is pretty simple. Its fast. I want to keep it as fast as possible with very low overhead, without using Views.

I've created the appropriate code needed to create a form, blocks, and a page callback via a custom module. What I would like to do is have someone use a custom search form, hit submit, and be sent to the search results page callback.

What is the best way to store and read from form values in a page callback? Is there any way to have values persist outside of $_SESSION? Or is that the best method? If I wrote a method in my search class that inspected $_POST and did proper validation on it, would it be better to use that to keep executing a search based on that?

I already have paging methods worked out in the code, but kind of scratched my head on how to execute a form, then when using a pager, keep those values for querying the next set. I think I am close, but wanted some input if there is a way I am not seeing.


texts: Which webform hook and how use to set programmatically webform target email?

texts:
First part as in title and how to detect different webforms?

Ex. function name - hook_webform_submission_actions

Replace 'webform' with form id?


texts: Testing Modules with an External Database

texts:
I'm writing an application that is using Drupal APIs to connect to an external database and doing a bunch of stuff with this data (reading/writing/deleting). I was wondering if there are any best practices for writing simpletests in Drupal 7 with this kind of application. I know simpletest basically installs a new instance of Drupal, then uses this sandbox environment to do testing. However none of the schema for this external database is defined in drupal.

Any tips on how I can test against this database, and not have a bunch of left over data when tests complete?


texts: How to get values which changed during node edit in node api?

texts:
I have a node with user entity reference field. Now I want to get newly added users id's to this node via this field in hook_node_update

What is the best way?


texts: I have successfully installed Varnish cache with my Drupal instance for both PROD and TEST servers. My PROD server seems to work without any problems. However my TEST server (which has the SAME configurations with the PROD server) does not seems to work. More specifically, i have the same configuration for both Apache and Varnish default.vcl file. My TEST server varnishstat shows that cache_hits are <= with the cache_miss while my PROD server's cache_hits are obviously much higher that cache_miss. I'm desperate with this issue. Don't know what else should i search for.


texts:
I can't figure out why users are redirected to http://example.org/user (the domain is just an example) when they log in. I don't see a rule anywhere. I have written rules to redirect somewhere else upon login, and the rules do not work. I suspect the Logintoboggan or the Drupal Commerce, but I can't find any settings that would cause this. I don't have any other redirect modules installed.

Why are user redirected to their user profile after they log in?


texts:
I just moved a website to drupal 7 and I have problems with the redirects.

The old website had all urls like this:
www.example.com/index.php?var1=aaa&var2=bbb
(where aaa and bbb changed for the different pages)

In the new Drupal website I use alias, so for example the page:
www.example.com/index.php?var1=aaa&var2=bbb
now it is replaced by
www.example.com/content/something

I tried to redirect the old url to the new one with two different methods, but both failed. They redirect the users to the homepage.

I create an alias
I added a rewrite rule in the .htaccess file
RewriteRule /index.php?var1=aaa&var2=bbb /content/something

As I said, both of them redirect to the homepage.

Any idea?
thanks!


texts: AJAX forms will break when used in subform

texts:
When using the following AJAX element in a BlockBase extended class everything seems to work just jolly good in the Block-layout page.

$form['foobar_row']['add_more'] = [
  '#type' => 'submit',
  '#value' => $this->t('Add more'),
  '#submit' => [[$this, 'addOne']],
  '#ajax' => [
    'callback' => [$this, 'addmoreCallback'],
    'wrapper' => 'foobar-wrapper',
    'method' => 'replaceWith',
    'event' => 'click'
  ],
  '#id' => 'foobar__add_more'
];

Though, the block form will fail when used as a subform, in my case it's being used in a paragraph, which contains a block_field. And I can completely see why it's failing, since the $form in the callback method contains the entire node form. I even experimented with the following alteration to my callback method, which works, but is absolutely no solution since the entire path to the element should always be the same.

  public function addmoreCallback(array &$form, FormStateInterface $form_state) {
    $referral_field = $form_state->get('num_foobar_rows');

    // Note every parenting element being addressed in following, but I would ideally only have to define ['settings']['foobar_row'];
    return $form['field_paragraphs']['widget'][0]['subform']['field_paragraph_block_blocks']['widget'][0]['settings']['foobar_row'];
  }

How would I make my addmoreCallback more dynamic and make sure it returns the right element?


texts:
I have a mailchimp subscription content type that add a user to the email list in mailchimp. It works great and adds them to the list.

However, I want deselect that checkbox when they fill out a second content type with a rule.

So, on creation of content type unsubscribe, check mailchimp list and remove email from list.

I have been search for ideas everywhere and cannot find anything in a tutorial or in Drupal Stack Exchange. Looking for ideas to try and hopefully figure out. Thanks!


texts: What is the first parameter of this db_query call for?

texts:
I've inherited some code. It works, but I'm wondering what the "5" does in this db_query statement.

$result = db_query(5, "SELECT * FROM {foo} WHERE bar = '%d'", $bar_val);


texts: Display comments according to the users roles

texts:
I try to create various tabs for my nodes, which show a specific field and the comments of the users according to their roles :

I would like that these tabs are pages, and not in Javascript tabs.

I tried with Views, I created a view of comments, I manage to create pages, to have comments according to the roles, but not to add the desired field (what must be normal because it is about a view of comments and not about contents) :

I could can possibly serve me as templates, with templates suggestions, create a template by page, but I do not know how in the template to display comments according to the roles of the users...

Would you know a solution?


texts: custom user page image field crashes when uploading, removing image

texts:
I am loading user form with this code

   $account = user_load($user->uid);
  module_load_include('inc', 'user', 'user.pages');
  $userform = drupal_get_form('user_profile_form', $account);
  return drupal_render($userform);

I have a image field in the form and i'm altering form to append another template file

function customuserprofile_form_alter(&$form, &$form_state, $form_id, $account = 'account') {
  switch ($form_id) {
    case 'user_profile_form':

 $form['#theme'] = 'custom_profile_form';

and i am printing this field in custom-profile-form.tpl.php

<div class="field1"><?php print drupal_render($form['field_profile3'])    ?> </div>

it is ok that code is showing me image field but when i click upload or remove button in image field i get this error

Notice: Undefined index: user_profile_form in drupal_retrieve_form() (line 760 of Z:\home\drupaler.uz\www\includes\form.inc).
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user_profile_form' not found or invalid function name in drupal_retrieve_form() (line 795 of Z:\home\drupaler.uz\www\includes\form.inc).
Notice: Undefined index: #user_category in block_form_user_profile_form_alter() (line 563 of Z:\home\drupaler.uz\www\modules\block\block.module).
Notice: Undefined index: #user in ckeditor_user_customize() (line 41 of Z:\home\drupaler.uz\www\sites\all\modules\ckeditor\includes\ckeditor.user.inc).
Notice: Trying to get property of non-object in ckeditor_user_customize() (line 41 of Z:\home\drupaler.uz\www\sites\all\modules\ckeditor\includes\ckeditor.user.inc).
Notice: Undefined index: #user_category in system_form_user_profile_form_alter() (line 1954 of Z:\home\drupaler.uz\www\modules\system\system.module).
Notice: Undefined index: field_profile in file_ajax_upload() (line 271 of Z:\home\drupaler.uz\www\modules\file\file.module).
Notice: Undefined index: #suffix in file_ajax_upload() (line 280 of Z:\home\drupaler.uz\www\modules\file\file.module).

problem is that image field works uncorrectly with in my page. but it is ok in /user/1/edit page Maybe ajax in uploading, removing image needs some corrections or any hacks? Please help me I'm in trouble!


texts:
I've been reading the whole day but I cannot find a complete example for a basic AJAX call on load page.

I followed this tutorial: and this example:

I was able to register the callback, controller and commands but the only way to trigger the ajax call is creating a link and is triggered on click event (as the example does)

XXX

I need to trigger that ajax call but when the page is loaded, is there any way?

Thanks


texts: Accordion is not working in field group module

texts:
I have configured the Field group module for Drupal 8 to manage the display of my node into accordion.  I added an accordion wrapper, and assigned an accordion item into it. Lastly, added the fields into the accordion-item.
But it does not seem to work as expected. Please suggest what I might be missing.


texts:
I'm working in an organization where we have our own exchange server. I'm developing a performance system to our employees using erpal.

I need an integration between exchange and Drupal that allows the employees to use their outlook calendar and tasks as same as erpal calendar and task (I mean the synchronization).

I found some ways doing it by using import and export but I think these ways are for Individual person. I need an automatic synchronization for all employees who have an email in our exchange server and can login to the system.

Is there any setting or module I have do? Or any steps link I can follow?


texts: Display teaser from entity reference field regardless of permissions

texts:
I have a Drupal 8 site with entity reference field that references nodes of type Colour. Colour node type is not accessible for anonymous users. I want to show Colour teasers though to all users when displaying its parent entity when it's referenced from field field_entity_reference_colours.
I need to achieve this in code as I cannot use views in this case.
I've tried preprocess_node function hook_entity_view and also hook_entity_field_access but all with no luck. Looks like the first two don't even get executed if users doesn't have access and the later allows access to field but not its content:
function my_module_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
  $result = AccessResult::neutral();
  if ($field_definition->getName() == 'field_entity_reference_colours') {
    $result = AccessResult::allowed();
  }
  return $result;
}

Can anyone give me a hint please?
Many thanks


texts: How to make mymodule_preprocess_node run only once?

texts:
We have a custom mymodule that calls mymodule_preprocess_node(&$variables) hook. When we add ksm($variables); to the hook, we are finding the message is printed multiple times (average has been 5x).

How to make mymodule_preprocess_node run only one time?

I am needing to run this hook because I want to check to see if a field is populated with some value then perform some other logic.

Example:

function mymodule_preprocess_node(&$variables) {
  $node = $variables['node'];
  if(isset($node->get('field_link'))) {
    // perform some logic.

   ksm('in here'); // printed multiple times.
  }
}


texts:
I cannot find a link to add seller/vendor/store in the Commerce-Marketplace module.

I am using Drupal Commerce Kickstart.


texts: Thoughts on best practices for user content management

texts:
I have a website where I need specific user roles (restaurant owner) to edit specific content type (their respective restaurant profile and services) which has a node reference field to the main restaurant profile.

I've been developing a website before where I needed to change the author of the node so this user could edit (with right permission) however, I'm sure there should be a better automated practice.

I am thinking of using Profile 2, with node reference user to a specific content type.

Any ideas on what's best to achieve this ?


texts: How can I determine if a form exists in my Drupal installation?

texts:
I have a form with a simple textfield where the user enters a string. I want to check if this string is a valid form_id in the website. I thought about using the drupal_get_form but even if it would work, it would be kind of an overkill to retrieve the whole form array just to check if it exists.

Any ideas are more than welcome.


texts: How can I add Zurb Foundation as a library?

texts:
I'm trying to add Zurb Foundation framework to my theme library file. However, when I add the following code to my library, I'm not getting any result.

I would be grateful to hear what is the problem with the code and what is the right way to load a library?

This is my theme folder structure (Zurb Foundation folder location):

|-Theme Name
|  |-includes
|  |  |-foundation
|  |  |  |-css
|  |  |  |-js

Library file:

foundation:
  version: 6.x
  css:
    includes/foundation/css/app.css: {}
    includes/foundation/css/foundation.css: {}
    includes/foundation/css/foundation.min.css: {}
  js:
    includes/foundation/js/app.js: {}
    includes/foundation/js/foundation.js: {}
    includes/foundation/js/foundation.min.js: {}
    includes/foundation/js/jquery.js: {}
    includes/foundation/js/what-input.js: {}


texts: How to generate a list of all valid URLs served by my site

texts:
Is there a way to generate a list of all valid URLs that a site will resolve, including redirects?

Specifically, all views, nodes, and redirects (the from and to.)

The list is required for record reasons by a college in another department.

An answer would be especially useful if it didn't require a code change, as it's production site, and a code change would have to go through code review and require a release, but if it's necessary then it's necessary.

Module wise, among many others, xmlsitemap, redirect, path redirect import, pathauto and pathologic are installed. I'm not sure if any of those might be of any use.

As a second question, if there isn't a way of automatically generating all of the URLs in a pleasantly formatted list, then besides manually collecting all of the views URLs and the redirects urls, where else should I be looking?


texts:
I have set up a node--home_page.tpl.php template with the following:

  <a href="<?php print render($content['field_primary_section_link']); ?>">

       <?php print render($content['field_primary_section_image']); ?>

<?php print render($content['field_primary_section_title']); ?>

        <?php print render($content['field_primary_section_body']); ?>

I want the anchor tag to contain the raw URL from the field_primary_section_link but it is pulling in everything around it. I just want the plain URL but am unsure how to do. Any help would be appreciated.


texts: Maisystem module not saving my custom class on production server

texts:
I have an issue with Mailsystem.
I want to use the Mailjet module to send my emails, and the HTMLmail module to format them.
I did it on my development server and it worked fine. I did the following :
On Mailjet administration page : admin/config/system/mailsystem
New class :
Class to use for the format() method >> Htmlmail
Class to use for the mail() method >> MailjetSmtpMailSystem
Then i saved the configuration, and in "Site-wde default MailSystemInterface", the new class showed up : HTMLMailSystem__MailjetSmtpMailSystem.

Then i tried to do it on my production server. It doesn't work. When i try to create a new class and hit "save" the new class is not saved.
I found the following error in my logs :
The specified file temporary://files5RLHj could not be copied to sites/default/files/mailsystem/HTMLMailSystem__MailjetSmtpMailSystem.mail.inc.

So of course i checked the rights.
I do have all the rights on the files folder and on the mailsystem folder.
I also have the rights on the tmp folder.

I checked with my ISP and he said he tried everything too and doesn't know what he can do.

I tried to copy manually the temporary file to its destination, but Mailsystem doesn't seem to realize it's there.

Please, tell me you have an idea where this problem comes from.

Thank you


texts: Why doesn't the view read cookies on AJAX refreshment?

texts:
I use views_extras module to get default argument froom cookies.
It works ok.

But if I set a cookie value using javascript and then refresh a view using ajax the view still shows result for previous value.
So the new value affects only if I reload page.

Why and how to make ajax requests use current cookie?

Btw, I wrote my own module to read cookie value and use it as default
argument: the result is the same with views_extras module.


texts: How to approach scheduled rules to real deathline?

texts:
Hello Im facing a problem, I made an app that makes use of a lot of scheduled rules, I could notice that those rules are not executed exactly in the time that is indicated in the schedule, those rules executes with the CRON, so for example if the rule reaches the deathline it only is executed after run of CRON.

So I had to set the CRON to run more frequently but is there another way of make the rule executes exactly in the set deathline?

my app needs to be very accurate in the execution of those scheduled rules so that's why...

Thank you


texts: How to use ajax callback on auto complete field inside a block settings form?

texts:
public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);
    $selected = 'value of a field';
    $form['node'] = [
      '#type' => 'entity_autocomplete',
      '#title' => $this->t('My content type'),
      '#target_type' => 'node',
      '#selection_settings' => [
        'target_bundles' => ['bundle'],
      ],
      '#ajax' => [
        'callback' => [$this, 'my_ajax_callback'],
        'wrapper' => 'my-specializations',
      ],
    ];

    $form['first_select'] = [
      '#type' => 'select',
      '#options' => [0 => 'x', 1 => 'y'],
      '#title' => 'doctor',
      '#ajax' => [
        'callback' => [$this, 'my_ajax_callback'],
        'wrapper' => 'my-specializations',
      ],
    ];

    $form['specializations'] = [
      '#type' => 'select',
      '#title' => $this->t('Specializations'),
      '#options' => $this->specialization($selected),
      '#prefix' => '
',
      '#suffix' => '
',
    ];

    return $form;
  }

 private function specialization($selected) {
    if (!empty($selected)) {
      return ['1' => 'a', '2' => 'b'];
    }
    else {
      return [];
    }
  }

  public function my_ajax_callback(array &$form, FormStateInterface $form_state) {
    return $form['specializations'];
  }

The ajax call back function is not working on auto complete field. How can I make it working on the auto complete field?
And on the first-select it is working but I am getting an error:
TypeError: Argument 1 passed to Drupal\Core\Render\MainContent\AjaxRenderer::renderResponse() must be of the type array, null given, called in /var/www/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php on line 89 in Drupal\Core\Render\MainContent\AjaxRenderer->renderResponse() (line 53 of /var/www/web/core/lib/Drupal/Core/Render/MainContent/AjaxRenderer.php)
Can you someone tells me, what I am doing wrong?


texts: What are the ways to handle a fresh new project?

texts: There is a lot buzz around regarding installing Drupal via Composer, but many tutorials manage Drupal via Drupal Console. Last but not least, the other Drupal command line tool, Drush. It causes lots confusion and I would love to hear a good round up what each tool brings.


texts:
Why do certain fields not behave like fields? For example 'Product title' and 'Product price' fields from Drupal Commerce:

You can tell that these two fields are composed very differently. I have noticed that most fields have the same composition as 'Product price' above; whereas 'Product title' doesn't even look like a field.

Matter of fact, the question could be rephrased as: why isn't 'Product title' a field, what is it? And how can I make it behave more like a field? Specifically, how to attach RDF mappings to 'Product title' using the RDF module, like you can with regular fields?


texts:
I have used "Profiles 2" module, and created a form where users can input their profile data.

I have also defined a content type, say "Blog" for example, which has a title and a body. I have used "Views" module to generate the output.

The question is, I would like to display a line like :
'Posted By : '

Is there a way I can extract the data from Profiles?


texts: Node registration form - redirect after submit

texts: short question. I'm using node registration module. Can i use hook_form_alter to redirect to some custom page after form submit?


texts:
I have a theme, and many subthemes, with the goal of creating a network of sites that are different, but share some resources (like the stackexchange sites do).
What I want is to include lots of boilerplate css in the master theme, and then site specific css included for each subtheme.
The problem I have is the CSS of the master theme is not being loaded in the subtheme.

The master theme:

name = Master
description = Master theme
core = 7.x

stylesheets[all][] = css/network_style.css

and the sub theme:

name = Red Theme
description = specific theme for site in network
core = 7.x

base theme = Master

stylesheets[all][] = css/red_style.css

Ideally then, the master theme just has network_style.css, and the sub theme has network_style.css and red_style.css.

If I enabled the master theme, then the network_style.css is applied. If I enabled the sub theme, then only the red_style.css is applied. There's no css conflict, and the master theme isn't visible in the page source at all.

Where am I going wrong? I'm somewhat new to Drupal.
I've gone through lots of documentation on the drupal site, and checked through all the drupal 7 specific stuff on theming.
I've tried clearing the drupal cache, plus my browsers cache, even turning server on and off like a mad man.


texts: "Enterprise" authentication, single sign-on and user provisioning for multiple sites

texts:
I'm looking for a solution for user provisioning, authentication and single sign-on which will make it easy for me to manage accounts for all the staff at my company across all of the sites we work on.

My main goal is to have a single point at which I can add/remove users to grant/revoke access to all the sites our staff will need to work on. This is obviously a pretty useful thing on it's own, but it'll also mean that I can ask staff to change passwords regularly without it taking a day to go through every site, etc. All this is in addition to "normal" users which vary from site to site.

The shared tables approach won't work (and wouldn't use anyway), I don't fancy setting up an LDAP server just for this, none of the sites share a domain so Bakery won't work, the OpenID module allows any provider so I can't trust the profile details to automatically set roles, etc.

Is there an existing (production ready) solution that uses, e.g., OpenID but lets me restrict the provider/s to those I can trust? Should I just bite the bullet and start trying to hack at the OpenID module? Am I barking up the wrong tree?


texts: How do I add an Organic group to my main menu?

texts:
I have read the documentation for Organic Groups Version 7.x.1.x (is there any more/better?) and created a group type "group content" and a group.

Question (and it may not be an OG question because I am a total n00b) - how do I add a top level menu "Groups" to my main menu? Specifically, what do I add for "path? ?

And then how do I add a group or two as sub-items to that menu?

Thanks a 1,000,000 in advance


texts:
Why is the image field in Drupal 7 CCK not supporting a bmp file extension? When I add this format in the field "Allowed file extensions" list, it saves, but never show it in the form and does not let me upload a bmp file also.

Is it a natural occurance? Is there anything I can do about this?

Thanks.


texts:
In Drupal 7, with the aid of features, we could do something like node_export, or uuid_features, etc.

I'm looking for a good way to create content / other entities using the UI and export it to code some how using Drupal 8 so that I can put into an install or update hook so that our site builders don't miss pieces of configuration.

I know we can do it programatically. And I'm all for that. I would just like an easy way to generate the Array we need to stick in our install or update hooks.


texts: Email all Organic Group members when a subgroup is created

texts:
I have an Organic Groups / subgroups structure where an Organisation is a group, a Property is a child group of an Organisation, and a claim is a child group of a property. So:
Organisation > Property > Claim
Each subgroup is set to inherit its parents users

When a new Property is created, I can use rules to 'Get group members from group audience' to email all of the members of the group:

However when a new Claim is created the same rule only emails the user who created the Claim. I think that this might be because inherited users are handled differently from normal users. You can see this by going into the 'group' tab on the claim and then clicking on people:

We can see in the screenshot above that there are three inherited users, but only the user who created the node will be emailed, the other two will not.

How should I email the inherited users when subgroups like Claim are created?

-- Addition --

og_subgroups.views.inc is used to create the view shown above. The contents of this file are:

function og_subgroups_views_pre_render(&$view) {
  if ($view->name == 'og_members_admin') {
    // Add an overview of the users that are inherited from parent groups.
    $inherited_users = _og_subgroups_get_inherited_users($view->args[0], $view->args[1]);
    $header = array('Name', 'Inherited from');
    $rows = array();
    $membership_states = og_group_content_states();
    if (!empty($inherited_users)) {
      foreach ($inherited_users as $inherited_uid => $data) {
        $row = array();
        $row[] = l($data[0]['user']->name, 'user/' . $inherited_uid);
        $inherited_from = array();
        foreach ($data as $inheritance) {
          $inherited_from[] = t('!parent (@roles)', array(
            '!parent' => l(entity_label($inheritance['inherited_from']['type'], $inheritance['inherited_from']['entity']), 'group/' . $inheritance['inherited_from']['type'] . '/' . $inheritance['inherited_from']['id'] . '/admin/people'),
        '@roles' => implode(', ', $inheritance['roles']),
      ));
    }
    $row[] = implode(', ', $inherited_from);
    $rows[] = $row;
  }
}
$view->attachment_after = theme('table', array(
  'caption' => t('Inherited users'),
  'header' => $header,
  'rows' => $rows,
  'empty' => t('No inherited users.'),
));
  }
}

It would be great if someone could suggest how I might be able to use the above code in rules. It would be great if I could use'Execute custom PHP code' and use something like

$inherited_users = _og_subgroups_get_inherited_users($view->args[0], $view->args[1]);

but that doesn't work in a custom PHP block in Rules. I can see the function _og_subgroups_get_inherited_users in og_subgroups.common.inc and am not sure if I can use this code to help.

Using Organic Groups 7.x-2.7 and Organic groups subgroups 7.x-2.0-beta1


texts: How to properly alter the output for fields of type file?

texts:
I have a file upload field which's format is set to generic file. It prints the following markup:

    Lorem ipsum

    ...

But I'd rather not show the img at all, alter url text, something similar like this:

    $filename
    $description text of this field

What hooks would I have to use for this? And why is this so hard to find on the docs?!


texts: Update Entity Reference View based on form field selection

texts:
I have a Content Type called Licence which has two fields, field_product and field_billing_cycle. Both are Entity Reference fields, using the select Widget. The product content type has a multi value entity reference that links to billing types. So each product has its own billing cycle with different prices and lengths etc.

When editing/creating a licence, I want to show only the billing cycles available for the product selected. I have created an entity reference view and set it all up so that it take a conditional filter arguements (The view seems to work, i set the contextual filter to a product id and it shows the right cycles). The only thing left now is to put it all together so that when the select list is changed, the billing cycles are updated but I cant seem to get the events right. Here is what i have so far:

function mymodule_form_node_licence_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $form['field_start_date']['widget'][0]['value']['#ajax'] = [
    'callback' => 'mymodule_update_end_date',
    'event' => 'change',
  ];

  $form['field_product']['widget'][0]['value']['#ajax'] = [
    'callback' => 'mymodule_update_billing_cycles',
    'event' => 'change',
  ];

}

function mymodule_update_end_date($form, $form_state) {

  $start_date = $form['field_start_date']['widget'][0]['value']['#value']['object']->getPhpDateTime();
  // Calculate end date (add two months).
  $end_date = $start_date->modify('+2 month')->format('Y-m-d');

  $response = new AjaxResponse();
  $selector = '#edit-field-end-date-0-value-date';
  $method = 'val';
  $arguments = [$end_date];
  $response->addCommand(new InvokeCommand($selector, $method, $arguments));
  //$response->addCommand(new AlertCommand('Blah'));
  return $response;

}

function mymodule_update_billing_cycles($form, $form_state) {
   $response = new AjaxResponse();
   $response->addCommand(new AlertCommand("This is a test"));
   return $response;
}

The code for modifying the end date when the start date is changed is firing but the product change is not!

I want to get to the point where when the product is set, the cycles are updated. When the cycle is set, it updates the end date based on the cycle length added to the start date field. If the start date field is then changed it should update again based on the selected cycle but I am stuck. I have googled and googled but not managed to get it to work. Where am i going wrong?

***** Updated *****

Ok, so i have worked out why the event wasn't firing and have fixed it, the function above is now working. For anyone having a similar issue, it appears i should have added the ajax handler differently for the Select list:

function mymodule_form_node_licence_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $form['field_start_date']['widget'][0]['value']['#ajax'] = [
    'callback' => 'mymodule_update_end_date',
    'event' => 'change',
  ];

  $form['field_product']['widget']['#ajax'] = [
    'callback' => 'mymodule_update_billing_cycles',
    'event' => 'change',
    'progress' => [
      'type' => 'throbber',
      'message' => 'Please Wait...',]
  ];

}

So now I am onto the next problem... How do i refresh the Entity Reference View, passing in the newly selected product id??


texts: Views contextual filter from user registration field

texts:
On user registration i have added field PROFILE (field_profile) which is used as company name. Each company can make simple galleries.

Tokens are used to create all content for all users.
For main content profile i have:

www.example.com/companyname (field_profile) (where comapnyname is used from PROFILE field).

For gallery links are made like this:

www.example.com/companyname/gallery/node1
www.example.com/companyname/gallery/node2
www.example.com/companyname/gallery/node3

I need help with creating view:
www.example.com/%/gallery - which would list all node galleries made by the user.

This link would only be available in sidebar block when someone lands on:
www.example.com/companyname  or
www.example.com/companyname/gallery/node1,2,3

Gallery node is content type which has hidden field field_userprofile which is autocreated and uses token [node:author:field_profile] which is also used to create the "gallery" part of the link and auto node title which both work fine.


texts: Different fields in user profile for different user roles

texts: I have created user roles parent, teacher and student. I want to relate parents with a student by creating a Field Related student for only parents. I tried using User References. But that makes the field common for all user roles. I also tried Profile2 module. But that doesnot exactly fit what I want. Is there any other way to achieve that ? Any suggestions please. Thank you.


texts: Update node revision time in hook_entity_presave

texts:
In my site Drupal 8, I have custom entities (say components) and bundles. I load these entities in a node using the Inline entity module.
On the front-end, the contextual links provide two edit links: an edit link to edit the node with all inline entities and a link for a specific entity. When users use the second link, they get the edit page for that entity and its field values. Using the second link, the node last update value won't change.

I tried updating the node value in hook_entity_presave(), but it creates infinite redirection. How do I avoid it?


texts: Image is "broken" with Custom Email Twig Template sending with Webform

texts:
The setup consists of Drupal 8 + Webform (ver. 5.6 - https://www.drupal.org/project/webform/releases/8.x-5.6) + CKEditor Image Upload (https://www.drupal.org/project/ckeditor_uploadimage). This allows for users to copy and paste screenshots of issues into CKEditor easily.

When the user takes a screenshot and then uses CTRL+V to paste into CKEditor - the image is uploaded to the server and it works perfectly.

The problem arises when the user right clicks within CKEditor and selects "paste" from CKEditor's right click context menu - it then embeds the image directly (data uri - eg.

<img data-widget="uploadimage" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAiwAA....)

which isn't a problem, until I the email is sent.

I'm using a Twig Template for the body of the message (it's being emailed / pushed into a ticketing system, thus the need to customize the look) and the code is the following:

{% set upload_screenshot = webform_token('[webform_submission:values:upload_screenshot]', webform_submission) %}

{% if upload_screenshot %}

Screenshot(s):

 {{ upload_screenshot }}
        {# Used to try to debug why data uris weren't rendering - with webform debug it displays data uri images, but the downside is that it doesn't render regular image uploads. #}
        {#{{ webform_debug(upload_screenshot) }}#}

    {% endif %}

If I use the "Default" template, any type of image (whether uploaded or as an embedded image) works fine. So I'm starting to think it's the way that webform_token processes / outputs the information.

When I inspect the code in the broken image, I notice that the data: is removed from the src

<img data-widget="uploadimage" src="image/png;base64,iVBORw0KGg )

For the meantime I'm disabling the right click context menu with this module. (https://www.drupal.org/project/ckeditor_browser_context_menu)

Any ideas on how I can get the images (whether uploaded or embedded) in a custom twig email template would be appreciated.


texts: Drupal 7: Multiple View Mode in Views Search Filter

texts:
I have a Content Type with 2 Custom View Modes.
Is there a way to combine View Modes into one search filter in Views?

What I'm trying to do is create a search function using Views Filter.
If the search term exists in the Teaser View Mode, only that View Mode will be used in search result, and if the search term exists in the Second View Mode, the same thing happens (only that View Mode will be used in the search result).

How can I accomplish something like this?

Edit:
Here is an example. I have a Movie listing. When I would like to search the Movie Title, the result would only be the Movie with its images (View Mode 1). When I search for Casts (Names), only the name listing would show (View Mode 2). But all the data are in the same Content Type.


texts: How to auto unpublish a node after edit and later published by admin?

texts:
I need to unpublish my node after edit. For this I created a rule. It's doing the unpublish of my node after editing. But after this I am not able to again publish this node.

I also need to fire a mail to admin after update.


texts: How can i insert a comment form between parent comment and comment replies？

texts: i want hide the comment reply，when user click the “2 replies” button will slide the replies，after slide out the replies i also want to show a comment form that people can post a reply easily.   anyone can help? Thank you so much.


texts: Apply custom css class while rendering an image

texts:
Here I want to add an attribute for custom css class, is this possible using field_view_value, field_menu_image is my image's machine name

$image = field_get_items('node',node_load($nid, NULL, TRUE), 'field_menu_image');
$output=field_view_value('node', node_load($nid, NULL, TRUE), 'field_menu_image',$image[0]);
print render ($output);


texts:
I have a Drupal 7 site with many custom filters. Everything works correctly, but not quick.
It looks as though the filter cache system does not work properly because the cache_filter table is always empty.
There is the issues in d.o. but it isn't replied.


texts:
I am working on replication, and I am stuck on MySQL dump. I want to know if there is the need of installing MySQL dump (I just have mysql community ed: version 5.5 on both servers)
because I am stuck on executing dump command. On Google I did't find any solution.


texts: is it a security hole to verify an uploaded supposed-to-be-zip file as a zip with zip_open()?

texts:
Question's subject is pretty much it.

I have an upload widget on a custom content type that is for users to provide a zip file.

I want to verify the file they provide is indeed a zip file, and take appropriate action if not. However, first I need to know if it's safe to pass an unknown file type to zip_open(), probably using the ZIP_CHECKONS flag for extra integrity checks.

edit: just realized ZIP_CHECKONS is not exposed in php. :(

Is this a safe way to verify a file is a zip file?


texts: automatically reference user to node by date field

texts:
I'm totally stuck in this situation, can't find any solution, please help!

i have content profile date field "date of birth" (y-m-d) and node "horoscope" with multiple value date field (m-d). When new user registers his date of birth I need to auto-reference to the horoscope node with same date. Year is not important in that case.

For example:

I have "horoscope" nodes: (title - dates)

Horoscope A - 01.23, 03.11, 05.02
Horoscope B - 02.14, 07.01
Horoscope C - 11.11
Horoscope D - 02.10, 03.02, 05.07, 09.14
After new user registers his account with date of birth: 1977.07.01, I need "horoscope_reference" field to automatically assign him "Horoscope B" or if entered date of birth: 1234.03.02, "horoscope_reference" should be assigned to "Horoscope D" and so on...

any suggestions please? (drupal 7)

Thank You..


texts:
I am trying to edit the existing order administrative view of my drupal commerce store. What i want is, adding a new column which indicates the sent status of the PDF invoice.

What i have done so far: stored a value into database once email was send. Now i need to populate it in to order administrative view as a new column which shows the sent status of the each order.

Any help, or tips would be appreciated


texts:
I have a view. And I want to have some conditions for particular field name in a twig template. the template is views-view-fields.html . I have tried with devel modules also. But now getting. Please help.

code:

{% for field in fields -%}
   //if field.name == 'something' then do this
{%- endfor %}


texts: How can I patch a node via REST in different languages?

texts:
I'm using the REST API to get my Drupal content into an app. This app has to be translated to at least 8 different languages, so we are using Crowdin as a translation service. I wrote a small module that automatically sends the title and subtitle of a node to Crowdin for translation and I'm working on sending it back, when my file was translated.

Now to the problem:

How can I patch a node to add a title for a different language than the default one? Or do I have to post it again? When translating it in Drupal directly I get two nodes with the same ID and different language codes.

But how do I do it via REST?

Creating a node is no problem, patching a node is also no problem but I don't know how to patch it for a different language than the default one.

Can anyone help me out?


texts: What could be causing duplicate nodes to be posted?

texts:
One of the content editors for our site is encountering a duplication error when she posts calendar events. You can see what's happening on the front end here: https://www.library.drexel.edu/events

I'm pretty much brand new to administering drupal (outside of some minor content editing) and am just taking over the site in the interim after an employee left while we seek to fill the position.


texts: What is the purpose of modulename.api.php?

texts:
What is the basic concept behind hooks? refers to modulename.api.php.

Does this apply to Drupal 8? What is this file? Is there an example of how to code it somewhere?


texts: How to define a configuration variable of type multidimensional array in schema.yml?

texts:
How should we define a config variable of type multidimensional array in schema.yml file ?

Something which I figured out from drupal documentation is that we can define either type mapping for string value of array or type sequence for integer value or string value of array.

But I'm not sure how should we define for our multidimensinal array, as we have to mention the key first and then the type of value which can be assigned to that key.

For reference I'm adding the following e.g code

image.style.*:
type: config_entity
label: 'Image style'
mapping:
name:
  type: string
label:
  type: label
  label: 'Label'
effects:
  type: sequence
  sequence:
    type: mapping
    mapping:
      id:
        type: string
      data:
        type: image.effect.[%parent.id]
      weight:
        type: integer
      uuid:
        type: string

Any suggestions?


texts:
I am creating a new user programmatically in drupal7. At the time of user creation is there any way to flag the user automatically.
I am using flags module.
I tried in the hook_user_presave
function MODULE_NAME_user_presave(&$edit, $account, $category) {
$flag = flag_get_flag('name_of_the_flag');
$flag->flag('flag', $account->uid);
}


texts: I have an external database that I am wiring into views with hook_views_data().  This particular database is making use of DECIMAL data type.  What are the proper field, filter, etc, handlers to use with this?


texts: Custom Validation while adding a term under taxonomy

texts:
I want to use custom validation while adding a term. I used form alter and #validate function it's not working.Default validation function under taxonomy module is working but my custom validate function is not.

Here is my code

  function lms2_validate_form_alter($form , &$form_state, $form_id){

    if ($form_id == 'taxonomy_form_term'){
      $form['#validate'][] = 'lms2_validate_term_validate';
    }
  }

  function lms2_validate_term_validate($form ,&$form_state){
      drupal_set_message('hello');
  }


texts: How to display more than 10 items in link widget autocomplete?

texts:
This is a question about the Link module. Since with the Link module you can enter external or internal links both, we strongly rely on it.

Unfortunately the number of items to be displayed from its autocomplete field is limited to 10. We have a lot of nodes with nearly identical titles and so it comes that the node we are searching for doesn't get displayed in the autocomplete field when there are more than 10 matching titles.

The limit is hardcoded in core/lib/Drupal/Core/Entity/EntityAutocompleteMatcher.php. Is there an elegant way to increase this little number from within a custom module? Do I have to extend class EntityAutocompleteMatcher? Where would I have to place my extension and how to ensure it gets executed from within the link widget?


texts: How to link to section in same static page?

texts:
How to create a menu link to the section that will display when I click on the link and hide when i again click on the link..

link is

    contact me

the above link should open

//some code


texts: How to fully localize popup calendar field

texts:
Strangely my popup calendar is localized, showing day names and so on in correct language, but not the date in the textfield neither in the description, which remained Y-m-d formatted.

.

This should be french format : d-m-Y . And I also need to change default value from today to next week. So, as per this answer :

  (For date popup) Branch 7.x-2 :
  Implementing hook_date_popup_process_alter() you could remove the description...

I tried these diff snippets :

function vts_commerce_date_popup_process_alter(&$element, &$form_state, $context) {
  $element['#date_format'] = 'd-m-Y';//no effect
  $element['date']['#date_format'] = 'd-m-Y';//no effect
  $element['#default_value'] = date('d-m-Y', strtotime('+1 week'));//no effect
  unset($element['date']['#description']);//works but I need to display it with correct date format instead
  dsm($element);
  return $element;
}

From which snippets 4 changes the form element. Instead, snippets 1, 2, 3 changed $element into dsm() returned values, but change nothing in the form. So my questions are:

How to display date into the textfield and in its description in french format ? how to change the default value that will be shown on page loading ?
What is the difference here between $element['#foo'] and $element['date']['#foo'] ?

Many thanks for your replies.


texts: How can i print multiple query output in GLOBAL:PHP view field?

texts:
I have custom global:php fields on which I put the following code as value.

$shop_url=db_query("select page_url from mytable1 where user_id=$row->uid");
return $shop_url;

As output code, I put the following one.

foreach($shop_url as $data) {
  print($data->page_url);
}

I am getting no output. How can I achieve printing multiple database results in GLOBAL:PHP?


texts: Entity Reference auto complete term creation on the fly?

texts:
There is a reason why I'm using an (autocomplete) Entity Reference field on my Content Type, instead of the Drupal's default term reference. It is linked to a taxonomy vocabulary and it's working just fine for my purposes.

What I can't achieve is for a term to be created on-the-fly (auto-creation), if it doesn't already exists in the tax vocabulary, while authoring a new node of that Content Type. Just like drupal's default term reference can do.

Thanks alot for your time.


texts: Help me to create Drupal view to get similar result as from this sql query i provided (Organic group view0

texts:
SELECT B.title, c.name
FROM `og_membership` AS A
INNER JOIN `node` AS B ON A.gid = B.nid
INNER JOIN `users` AS C ON A.etid = C.uid
INNER JOIN `users_roles` AS D ON C.uid = D.uid
WHERE B.type = 'viu_course'
AND D.rid =7

here: B.type = viu_course is a content type and D.rid = 7 is the student role.

Please provide me, how to create view from view UI to get the similar result i get from this query.


texts: Commerce cart allowing quantity than In stock

texts: I don't know on how to validate the quantity, meaning if user add the quantity more than In stock, it should not allow the user to add more quantity than In stock(quantity available), I think it can be achieved in rules, but Im not sure to do that any pointer would be helpful!


texts: First Drupal site. I have a custom content type of 'books' which I want to add to the 'books' basic page. I literally have no clue how to do this, or what is the best 'Drupal' way of doing this.


texts: How add custom node in a View (Nested View)?

texts:
Currently I have simple view that is used on the main page. In includes nodes of custom type. That's great. But now I need to do something different.

Consider I have following structure:

-----View-----
-------Node 1--------
-------Node 2--------
-------Node 3--------
-------Node 4--------
-----End View-----

But I want to have the structure like that:

-----View-----
-------Node 1--------
-------Node 2--------
-------Node 3--------
---------View Nested in the node ---------
------------Nested Node 1-------------
------------Nested Node 2-------------
---------End Nested View ---------
-------Node 4--------
-----End View-----

So I need nest another view in a top level node.

How can I implement this?

Is there any way to do this using core functionality?
Otherwise I need to change the content of a node before data is passed to a template, but I don't which hook to use?

Please suggest how to deal with this task.


texts: Is there a drush command to show existing aliases? Some Googling didn't turn up anything.


texts: D8 doesn't create .htaccess for private file system path

texts:
Following this guide: https://www.drupal.org/documentation/modules/file it says

  "When you specify the private directory in
  admin/config/media/file-system it will automatically create the
  sub-directory & create a simple .htaccess file with Deny from all."

When you edit your settings.php and add the $settings['file_private_path'] = 'sites/default/files/private' after drush rc it doesn't create the .htaccess file in my sites/default/files/private and I do not know how the correct .htaccess should look so I could add it manually?

,


texts: When a user has forgotten their password, how to let them set a new one?

texts:
A user has forgotten her password, so she uses the 'forgotten password' function. She receives an email with one-time login, and proceeds to edit her profile to set a new password.

But that form requires the old password in order to reset password. A catch 22 situation?


texts:
I'm trying to build a new View in Drupal 8. I want to display list of News. Each item has field_date where is date (without time) stored. And second field is body with basic text information.

I'm trying to set FILTER CRITERIA to display only items with date <= NOW(). It seems that it's impossible to enter this filter. There is no condition for it. Do you have idea how to enter this? This is filter what I see in modal window for new filter citerium

<select id="edit-options-operator" name="options[operator]" class="form-select">
  <option value="=" selected="selected">Je rovno</option>
  <option value="!=">Není rovno</option>
  <option value="contains">Obsahuje</option>
  <option value="word">Obsahuje jakékoliv slovo</option>
  <option value="allwords">Obsahuje všechna slova</option>
  <option value="starts">Začíná na</option>
  <option value="not_starts">Does not start with</option>
  <option value="ends">Končí na</option>
  <option value="not_ends">Does not end with</option>
  <option value="not">Neobsahuje</option>
  <option value="shorterthan">Délka je kratší než</option>
  <option value="longerthan">Délka je delší než</option>
  <option value="regular_expression">Regulární výraz</option>
  <option value="empty">Je prázdný (NULL)</option>
  <option value="not empty">Není prázdný (NOT NULL)</option>
</select>

(Sorry for Czech localization but you can still see key of each option :)

I thought that shorterthan we be right option, but it seems to be suitable only for string. I know that Drupal 8 is still in beta today but this problem must have some solution. I'm using already included core extension Datetime.


texts: Authenticate users against Active Directory?

texts:
I've installed a test server with OpenAtrium, because I'm evaluating some intranet solutions for our organization.

I have a must requirement: users should be authenticated against an Active Directory server. I'm trying to follow this tutorial (https://www.codeenigma.com/community/blog/connecting-your-drupal-site-microsoft-active-directory-server), but I'm completely lost.

I've setup other AD connections (like Liferay or a custom-developed intranet web) using only the server IP, an username and a password and the canonical name of the server (dc=organization,dc=local). But there are lots of parameters to config Drupal's LDAP.

What is the standard configuration that should go in a configuration to access to a standard Active Directory? What should I put in the "LDAP Group Configuration", "LDAP to OG group Configuration" and "LDAP to Drupal role Configuration" groups?

I'm using the latest releases of Drupal, OpenAtrium, and the LDAP components.


texts: How do you allow users to add comments to your profile page? I'm already using content profile module but I don't know how to add comments to it


texts: Override of commerce-order-receipt.html.twig template not working?

texts:
My theme is using Bootstrap barrio theme (bootstrap_barrio) as a base theme. I'm trying to override Drupal commerce template modules/contrib/commerce/modules/order/templates/commerce-order-receipt.html.twig and it's not working for me. Even I copied that file to drupal/web/themes/my_theme/templates ,cleared the cache, Commerce is still using original template file from commerce module.
What puzzles me is that base Barrio theme also has that template and it's also not used?!?
Do I have to set somewhere what theme should be used for email templates or something? Overriding other modules templates (including commerce templates) works fine. Documentation says "The email can be customized by overriding the Twig template in your theme just as you would any other template".


texts: Drupal sitemap still contains urls of deleted pages

texts:
I've deleted some products from my commerce kickstart database by means of standard Drupal commerce kickstart tools. But it looks like something gone wrong. Because some deleted pages urls still remain in sitemap,so Google webmaster tools tell me about 404 pages.
   I've rebuilt sitemap n+1 times but urls of deleted pages still here, in sitemap file. Checking manually commerce_product table,for example,I found  that there are some tails(that should be deleted) remain in it.

What tables should I check up to find tails have to be deleted manually?What tables does the sitemap module use to build sitemap file?


texts: Dropdown menu of node titles that are made by a view

texts:
I'm trying to create a dropdown menu that is a list of titles created by a view.

So I've made a view that creates a list of titles of a content type. I would like that list of titles to be in a dropdown menu.

I am using Superfish now, but I am not fully committed to it. If you can suggest a menu that will make this work I'm open to that.

I thought Menu Views would be an easy fix combined with Superfish. Menu Views has this to say

  By design, this module only provides basic HTML structure for
  inserting a view into the menu system. It does not actually style your
  [mega-]menu. If no styling exists in your theme or is not provided by
  a contributed module, the view will appear next to your menu item
  (which can often be a little confusing at first). It is up to the
  theme or contributed module to actually style the view to appear
  inside your menu. If the contributed theme or module implements drop
  down menus, using CSS or JavaScript, a new child selector (li > .view)
  must be included. The view can then be styled appropriately from
  there.

I'm not sure where to start with the child selector.

Any advice on how to get the dropdown menu to display the node titles? Feel free to recommend any other modules that may help


texts: How to execute a query taken from views in custom module

texts:
Please don't suggest query builder, this is the single query I need run from my custom module with passing arguments.

I create a View with desire fields and copy/past the query in phpMyAdmin the query is not showing the actual values for columns instead showing value as NODE :(

Is there any way to achieve this?

Thanks


texts: Migrate Multi-value Filefield (File Description)

texts:
Posted this here as well http://drupal.org/node/1943324

I am trying to migrate multi-value file-fields.
I checked out the wine.inc but the sample provided doesn't work for me.
I tried to use JSON-encoded arrays that didn't work either and i read somewhere that method is now obsolete.

How to do this?

Here's what i have:

$this->addFieldMapping('field_case_file_upload', 'file_upload_url');
$this->addFieldMapping('field_case_file_upload:description', 'file_upload_title');
$this->addFieldMapping('field_case_file_upload:destination_dir')
             ->defaultValue('public://pdfs/sun_files');

    public function prepareRow($current_row) {
        $result = db_select('tbl_myfiles', 'f')
                  ->fields('f', array('file_upload_url', 'file_upload_filepath', 'file_upload_title'))
                  ->condition('content_id',$current_row->content_id)
                  ->condition('f.file_upload_url', '%pdf%', 'LIKE')
                  ->execute();
        foreach ($result as $row) {
              $current_row->file_upload_url[] = $row->file_upload_url;
              $current_row->file_upload_filepath[] = $row->file_upload_filepath;
              $current_row->file_upload_title[] = $row->file_upload_title;
        return TRUE;
         }
           }

I am sure im not doing something right. Can someone cool please point me in the right direction? :)

I have tried the solution provided here but still can't get the file_descripton in Migrating files with descriptions


texts:
I have a view with full pager, i am showing 10 items per page.
Now pager shows up like...

1    2    3    next ›    last »

I want to to show each pager number from which count it will start and end...like

1-10    11-20    21-30    next ›    last »

How can I do this?


texts: use block_load to load the same block with parameters?

texts:
I have defined a "userinfo_Block" block to show special user's info. I have a userlist.tpl.php template file.

What I want to do on this page is using block_load() to display each user's info, but I don't know how to send the userid to the block.

How can I achieve this?


texts: In Commerece 2.x can address be selected in the country's official language?

texts: Upon setting up the address book, how can the select list of Country/Province/City etc. be displayed in the country's local language rather than in English?  e.g  廣東省　instead of Guangdong Sheng if China is selected as the Country?


texts: EventSubscriber returning correct content but status code is 404

texts:
As the title says, content is being returned correctly but the status code is 404.
I have checked the .htaccess file and the Apache config file as well. All seems to be fine.
I have the following in my module routing file:
my_module.news_list:
  path: /api/{state}/news
  defaults:
    _controller: Drupal\my_module\Controller\NewsController::index
  methods: [GET]
  requirements:
    _access: 'TRUE'

This is the function that does the redirect in my EventSubscriber
public function redirectRequestToModule(GetResponseEvent $event) {
            $request = $event->getRequest();
            $validPathBegins = ['/men', '/nat'];
            // This is necessary because this also gets called on
            // node sub-tabs such as "edit", "revisions", etc.  This
            // prevents those pages from being redirected.
            $requestUri = $request->getRequestUri();
            if (!in_array(substr($requestUri, 0, 4), $validPathBegins)) {
                return;
            }

            $node = $request->attributes->get('node');

            // get the configured request query parameters for this content type

            $redirect_url = '/api' . $requestUri;
            $kernel = $event->getKernel();
            $response = $kernel->handle(Request::create($redirect_url));
            $event->setResponse($response);
        }

This is what I type in the browser: mysite.com/nat/news/
The content returned is correct but the status code is 404.
P.S There isn't a reachable path on my Drupal website like /nat/news. The path mentioned is supposed to return a list of news articles.


texts:
I am trying to set $cookie_domain in my settings.php within Drupal 8.

In Drupal 7, I add this in settings.php to set it up, but I am not sure how to do it in Drupal 8:

  $cookie_domain = ".domain.com";

Thanks a lot


texts: Change timezone display format in user edit page

texts: In drupal 7 timezone field in user edit will be like Asia/Kolkata: Friday, October 9, 2015 - 17:24 +0530. I want to display it like Asia/Kolkata. I have tried the method specifed in https://drupal.stackexchange.com/a/177073/50991 but not working. How to change the display format


texts: Im using entityforms to make events on a Calendar. How can i prevent duplicated dates?

texts:
I am developing a Booking System and I am having a issue i.e. How can I prevent duplicate events to be registered ?

Right now I am using:
Calendar and Date for the event management and Entity Form for the booking system.

Users book a date and a time (for example: 09 / 10 / 2014, 14:30 and this is done with the Date field)

The problem I am facing that I don't want to let the users book a date and hour that is already selected. How can I prevent that?

For example: If an user books 09 / 10 / 2014, 14:30, no other user can book for the same date and time. How can i achieve this? Entity Forms has the option to set rules (via the rules module) but my knowledge on rules is not that good. Hope someone could give me a hint. Thanks in advance.