texts: Commerce - How do you setup conditional shipping options that relate to a specific taxonomy term?

texts:
My store sells heavy and lightweight widget items. I currently have 1 product type and have 1 term reference field that designates it as either light weight or heavy weight

Now in my flat rate shipping setup. I have 2 flat rate prices. One for light and heavy. I add a condition to each of these shipping methods to check if its either a light or heavy object, but I'm not sure how I can retrieve these taxonomy references in the rules setup of the component. I would imagine i would have to do a commerce_order:line-item, but after that im stuck and not sure where to go to grab the taxonomy terms.


texts: Build taxonomy categories with views, only children

texts:
I am trying to build a menu with taxonomy terms and views.

Lets say that I have a tree of taxonomy terms

Parent-1

child-1.1

grandchild-1.1.1

greatgrandchild-1.1.1.1
greatgrandchild-1.1.1.2

grandchild 1.1.2

child-1.2

grandchild 1.2.1

greatgrandchild-1.2.1.1
greatgrandchild-1.2.1.2

grandchild 1.2.2

I am having problems viewing only the children of the taxonomy menu. I want to exclude the current level, and only see the children, not the grandchildren of an item. So for instance.

When I am viewing child-1.1, I only want to see grandchild-1.1.1 and grandchild-1.1.2, not any of the great grand children. I don't want to see child-1.2 or the parents.

Thank you very much for your help!


texts:
I'm working on a local version of an outdated Drupal 6 site which can not be shut down for a minute. The goal is to update the modules and give some enhancements, like adding tags, making a better menu and dynamic blocks etc with the least  possible down time for the site.

It will probably take a few weeks for me to do so. Meanwhile new content will be added to the production site as per usual.

My question is: When I finish developing the requested enhancements on local version, how should I integrate newly generated content to the development version before putting it online? I can not simply import the production database dump since this will undo my whole work. So obviously I need to import only certain tables. But how should I figure out which ones? What would you do in this situation?


texts:
This is the code which I have put in node.html.twig. It doesn't print the body and title of the node, whose bundle is Basic page.

How do I print node title and body of a node?

{%
  set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
'clearfix',
  ]
%}
{{ attach_library('classy/node') }}

{{ title_prefix }}
{% if not page %}

    {{ label }}

{% endif %}
{{ title_suffix }}
{% if display_submitted %}

    {{ author_picture }}

      {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}

    {{ metadata }}

{% endif %}

     {{ content }}


texts: Is it possible to create a list of pages in a view even if a user doesn't have access to those pages?

texts:
I'm creating a set up in Drupal 7 using Organic Groups and the Subgroups module where there is a Company group, and each company can have multiple Project groups. I'd like to allow users that have access to a Company Group to see all Projects underneath that company in a View, regardless if they're part of the project group or not. From there, a user can either view the project page, or they can subscribe to the project group.

Is it possible to give a user access to a parent group and allow to see all of its child groups in a View, but restrict viewing a page in a child group?


texts: Drupal site communication with other site

texts:
Hello I have a Drupal 7 site.
I want users to login without using the drupal form.
I will silently send username and password credentials from another site and when users click the link to my drupal site they will be already logged in.
So how to communicate with drupal login and send the details of the user from another site or maybe a browser plugin or a PC application etc.


texts: How to trigger a rules action only for a specific value of a user profile field?

texts:
I have created a Rules component which contains an action to send an mail.
And I have a rule created with the scheduler option. In this rule, I have set one condition like so:

if site:current-user field has value equals to something
then mail should be triggered,
otherwise it should not.

But it is sending an eMail in both cases. Any idea why?


texts:
We plan on updating our Drupal 6 (with MySQL 5.5x and PHP 5.x) site to Drupal 7.

Which version of PHP and MySQL should I choose?


texts: Altering fields before rendering: hook or template?

texts:
I have made some recent posts about Drupal 8 and its paradigm for altering fields. Having spent many hours reading up on APIs and some trial and error, I have come to the conclusion that I am really not sure how to proceed with certain basic tasks, such as altering a field.

So the point of this post is to see how one should go about a task such as altering a field.

First, let me describe exactly what I am trying to do. I would like to edit a field before it is rendered. It is an image field. So all I need to do is alter the target_id of the field that points to the image. I want this to happen in every view, display, etc.

Some thoughts:

Overriding via templates: I don't think this makes sense. Seems a template gets a render array, and that one would want to alter the array before the theme does its thing. Also, I want to be able to switch out themes, so this approach is non-ideal
Rewriting field in Views: since I want the fields to be altered regardless of whether it is Views, Display Suite, etc, this would not make sense
Module hooks: I think this is what I need to do, but the info online on Drupal 8 is fairly sparse. For instance, I found out by trial and error that mymodule_preprocess_field will not get called if the field is being shown by Views. The Views hooks won't make sense because as I mentioned I need to alter a field regardless of Views.

So this takes me to 3. You can see Drupal 8 hooks here. At first I was trying to use hook_preprocess_HOOK, and in my case mymodule_preprocess_field. But as mentioned above that was not getting called in Views displays. Then I thought about mymodule_preprocess, but deciphering its $variables array is proving daunting, and the more I read about Drupal 8, the more I am convinced that this probably is not really in the spirit of Drupal 8.

The field specific hooks don't seem to be a match, for instance, hook_field_info_alter seems like it is for altering meta data.

So finally, I came to the conclusion that with Drupal 8 being so Entities focused, I probably need to look at an entity hook. For instance one of the following:

hook_entity_prepare_view
hook_ENTITY_TYPE_view
hook_ENTITY_TYPE_view_alter
hook_entity_view

But coming to this conclusion, a) I am not sure it is the right conclusion, and b) if it is the right conclusion, how to choose one of the above and how to actually implement it? (Note, using dsm(), debug() in Drupal 8 often results in results that are not very decipherable since so many array elements are protected.)

Anyway, I am curious how others would go about this!

EDIT: The above entity hooks are not called for taxonomy page... So I guess that takes me back to hook_preprocess which seems to be the only way to alter the field in all cases. But still trying to decode the $variables array and figure out the right methods/functions to make changes.

Thanks


texts: Sort a related products view based on product features

texts:
Hi I followed the intructions here for createa a view of related products for my commerce kickstart website, those related products are selected based on taxonomy vocabularies like texture, color, size, etc...

Right now the products are sorted by the title, but I do not want to sort them like that, I want to sort them based on a feature like color, texture, etc..

Allow me give you an example:

if I go the the product display of the product X that is of gray color, in the related products block I want to display first those that match the same color, so other related products that also have gray color will be displayed first.

Thanks for your help


texts: How to remove orphaned actions if you get not authorized access as uid1?

texts:
I get this error 1 orphaned actions (views_bulk_operations_archive_action) exist in the actions table. Remove orphaned actions

But when I click Remove orphaned actions I get You are not authorized to access this page..

And I'm logged in as UID1 user.

Can this be solved via drush?


texts: How to display blocks depending on the logged in user?

texts:
How can I display blocks depending on the logged in user?

Let's say I have a Block1 and Block2. When user1 is logged in, that user should only see Block1, but user2 should only see Block2

I found the Logic Block module, but it doesn't seem to work for what I'm trying to do.


texts: Get page title of view and panel page via url

texts:
Is there any way to get page title of view and panel page using url. I tried

$normal_path = drupal_get_normal_path($path);
$item = menu_get_item($normal_path);
$title = $item['title'];

and it is giving empty title while it is working well for normal node.

Please suggest.


texts: Add 'Top product' field to products Ubercart

texts:
I'm trying to filter products on the homepage of my webshop (Views module). I want to add small ribbons to my products like: New,Top,Sale.

I made everything with the Views module but I think need to add a field to the Product content type but don't know what I need to choose, if I edit the product there should be a checkbox so I can edit if this product is New,Top,Sale or not.


texts: Correct way to change the active Drupal theme programmatically?

texts: What is the correct way to change the active Drupal theme programmatically?


texts: Automatically attaching/relating one view to another view based on same value in one field

texts:
My Drupal site draws data from a CRM system that stores info on contacts and companies. In the CRM, the contacts are related to the companies by a common ID. I have set up Drupal to automatically import the contacts and companies as separate content types and keep them up to date. Both the 'contact' and 'company' content types have an ID field, which is used to relate which contacts work for which companies.

I can create a view, with a page that shows an individual company. I am not sure how to attach a view of the contacts that work for the company. I know it would be possible to use node reference and EVA to relate the contacts with the companies manually. Unfortunately when new companies and contacts are added to the CRM the Drupal site needs to be able to create the relationship between the two automatically, probably based on the fact they both share a common value in the ID field.

It would be great to know how other people have managed to create relationships between two content types. I am not sure if there are any modules that can help with this, if I should create a theme template page for the company view page, and hand code some php that queries the database to return the related contacts, or if need to figure out how to build a module to do the above.

Thanks for your help, Paul


texts: Is it good idea to install modules, which require server config, locally? How?

texts:
There are few modules which require server side config to work. If you have a hosting and domain, it is not a big problem, but if you are developing locally, then I guess it is a problem.

If you somehow install and use these type of modules on local environment to test, you have to change the config once you move to production. For example Node.js integration, Twitter and other modules which require a setup before you can use them.

I am using acquia dev. I want to test some modules before going live as I mentioned above, but my question is how I can do that?

Note: Using such local environment is for me a way to reduce the cost of testing, since I wouldn't have to purchase hosting for that during a few months. In some cases, nobody would want to purchase a hosting and waste few months or a year for just testing.


texts: Why doesn't the token for the node title work?

texts:
In Drupal 8, I activated the Message module and the Message Example sub-module.

These are the fields I added to the template to create a message when a new comment is created.

This is the content of the message.

  1) [message:node-title]
  2) [message:field_node_reference:entity:title]

These are the tokens that are listed as available.

[message:node-title] is replaced from the title of the parent node, but [message:field_node_reference:entity:title] is not replaced. Why?


texts:
My Drupal database becomes very huge, it just related to cache_menu table:

~4,291,529 rows and 2.9 GiB

What can I do to prevent this? is there any way to change cache strategy for menu items? or simply I should EMPTY this table every week?


texts: Authcache settings for blocks or views in panels

texts:
I am setting up Authcache ESI and Varnish on Drupal 7. My site has panel pages that incorporate personalized blocks and views. Authcache allows caching parameters to be specified for blocks or views, and also on panels.

What is the recommended approach in this case? For example if I am placing a view in a panel page, should I:

Specify Authcache settings for the view only?
Specify Authcache settings for the view panel within the panel page only?
Specify Authcache settings for both the view and the panel -- and if I specify settings
for both, which takes precedence?


texts: Is there a modules "wish list" anywhere?

texts: I'm new to Drupal, and right now my job consists mainly of site-building. But I'm a PHP developer, and I'd like to get into module development. The problem is, anything I could think of to do has most likely already been done! Is there any kind of wish list maintained somewhere (on drupal.org) of modules that people wish would be written?


texts: How to update taxonomy on user profile from a view

texts:
I have an interesting issue and hope for advice on the best solution in Drupal 7.

I have a taxonomy that exists for events and also in the User Profile. The basic functionality I need is when the user clicks on button or link in a list of events, created by a view the taxonomy terms of type category are taken and added to the taxonomy term field (also of type category) In this way the user's profile gets updated with the taxonomy terms from the event. In this way the profile gains the preferences of the user.

I have the view set up so a link is my-view/term1,term2,term3

But how to get that exposed either to rules so I can loggedInUser - Set Value, I cannot see or find out how to link the two parts.

I have looked at Rules Links but the documentation seems lacking. I need this entirely reusable as the mechanism will be reused in two more use cases.

Has anyone any suggestions?

Or do I have to write a module


texts: How to skip client side validation for draft node?

texts: I am using clientside validation module for drupal 7.I have two button for submit node one is for save as draft and other submit so Now my scenario is that if i click on save as draft then it should not display client side validation error.


texts: Attach webform on each node of specified content type

texts:
I am currently working on real-assets project in which user can add property using property-listing content type for listing and searching property on portal.

if any visitor is interested in any property than he/she can directly fill the form, which will be present in full view of property node and send it to admin and also admin will get to know for which property visitor fill the form same like as comment for node.


texts:
I'm trying to create a View that displays a CCK Imagefield from an Organic Group node.

I have a content type called 'Subsite' that I'm using as the Organic Groups creation node. I've added a CCK Imagefield called "Banner" to this content type, so that each group has a banner image.

I'm creating 'Page' nodes and assigning them to Organic Groups.

Let's say I assign a page called "Page 1" to the OG "Group 1." How can I configure a View to display the banner on "Page 1"?


texts: Is this possible to copy Views fields declarations to another view?

texts:
Use case:

We have a page with a lot of complicated Views generating a lot of queries.
There is a way to do it in more efficient way but this needs a lot of changes in Views or even creating different views, similar in displays field declarations.

Is there any way to copy fields declarations between those views?


texts: How to validate a field value programatically in Drupal 8?

texts:
I've created a module for Drupal8 that checks against values in the user register and set an error if the values do no match with something you have entered in a custom form.

My module has got a form where you add a list of username you don't want the user to take and a custom message to display as an error.

Forms works perfectly, I can store data, edit it etc... It is stored under src/Form/ and settings are under config/install

Now when I'm trying to hook the user register form validate I got an error regarding form_set_error():

  PHP Fatal error:  Call to undefined function form_set_error()

Also I think I'm not using $form_state in the right way (but it does the job)

Here's the code in my_module.module:

function my_module_form_user_register_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
 $form['#validate'][] = 'my_module_user_validate';
}

/**
 * Custom validation function.
 */
function my_module_user_validate(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
    // get module settings
    $config = \Drupal::config('my_module.settings');

    // Convert $form_state to an array as it has been passed as object, it looks wrong but I could not find any documentation at the moment
    $form_state = get_object_vars($form_state);
    $name = $form_state['values']['name']);
    $usernames = $config->get('my_modules_usernames');
    // Username are inserted in a text area separated by an enter key
    $usernames = $usernames != '' ? explode("\r\n", $usernames) : array();
    foreach ($usernames as $username) {
      if ($username == $name[1]) {
        //apparently in Drupal 8 form_set_error does not work anymmore
        form_set_error('mail', $config->get('my_module_message'));
      }
    }
  }


texts: Creating view using Index results in "plugin does not exist"

texts:
I was having some problems with Search API after adding my second index (using DB not Solr).  The index I was trying to create was supposed to just be the body and title of a content type.  I was able to build the index just fine, but when trying to attach it to a view (My Test View) I'm getting a funky message directly above the Preview section on the view page.

  The "views_page:my_test_view__page_1" plugin does not exist.

I am utterly confused by this.  I uninstalled Search API and reinstalled, but the only change is this now happens to both views using a search index.  I am able to successfully create non-search index views, but that's the only evidence I have this is even Search API's problem.  Can someone please direct me on how to start debugging this?

This is Drupal 8.


texts: SFTP Can't upload module despite using owner's credentials

texts:
I'm new to both Linux and Drupal, but I can see that the owner and group assigned to the drupal modules directory is one of my SU accounts on the server. When I log on to SFTP I use that same credential.

I tried to upload a module using Aptana studio and it tells me it can't create folders.

Do you feel that there's additional ownership info needed on the server side? Would my folder rights not be applicable when connecting via SFTP?


texts:
I am new to drupal, and currently i am creating a webpage in drupal from html . i have almost completed. I have created web form for "Contact us" form, after creation it is not in proper alignment. So, my form should be look like the picture shown as below.

So, right now it is like as below image.

So, please someone help me to get out of this issue.


texts: I want to reset a managed_file field after AJAX form submission

texts:
I implemented a form with managed_file field.
$form['field_name'] = array(
  '#type' => 'managed_file',
  '#upload_location' => 'public://node_file/',
  '#upload_validators' => array(
    'file_validate_extensions' => array('png jpg jpeg gif'),
    'file_validate_size' => array(1024 * 1024 * 5),
  )
);

I am submitting a form using AJAX. I want to reset a managed_file field after submitting that form.


texts: How do you add the class of the user role to the body tag, say in html.html.twig, in much the same way as you can add the path in How can I dynamically add URL or taxonomy to body class?


texts: Views contextual filter with php validation

texts:
The problem:
How to use php code to fetch 2 UIDs from a View and compare them to validate the View
The situation:
I created a View in Drupal 7 that lists all entities of the entity type of "Session" (ECK) by USER A (a teacher).
USER B (a student) is the logged-in user and looks at that list view of USER A.
Both users have connected "User Info" entities (ECK) that are used to show particular profile info.
The eck_user_info_student (ECK) of USER B has a property called "my_active_course" which can only contain an integer and a single value, in our case an ID.
The eck_course entity type (ECK) has a property called "teacher" which can only contain an integer and a single value, in our case a UID.
First contextual filter:
Now I need to check IF the teacher of USER B's active course (UID) is the author (UID) of the Sessions that USER B is looking at. For convenience, I have added the author UID of the Sessions to the URL. So that we can use that as the first contextual filter. If no UID is in the URL, the view will display an Access Denied page.
I have the following machine names in the database:
field_student_profile_ref the User account field (single value, integer, uid)
eck_session the Session (ECK Session entity type)
eck_course the Course (ECK Course entity type)
eck_user_info_student the Student User Info (ECK Student entity type)
eck_user_info_student:my_active_course the Active Course (single value, integer, id)
eck_user_info_student:my_active_course:teacher the Teacher UID on the Active Course (single value, integer, uid)
The IF/ELSE comparison
IF the author of the Sessions (UID) is equal to the teacher of USER B's active course (UID),
=> display all Sessions.
ELSE the author of the Sessions (UID) is NOT equal to the teacher of USER B's active course (UID),
=> display an "Access Denied" page.
Therefore I currently believe that I need to write a comparison statement in php code in the section "specific validation criteria" where I have the global user i.e. the logged-in user and create a variable where I store the UID from the Active Course of User B and I think that this last part is the actual problem: how to load that?
The code below is just provided as a starting point
<? php
global $user;
$show = false;
$teacher = $argument;
// provided in the URL
$my_teacher = $user->['field_student_profile_ref']['my_active_course']['uid'];
// the UID of the Teacher in the field "my_active_course" on the eck_user_info_student
if($user->uid == $my_teacher->uid) {
  $show = true;
}
else {
  $show = false;
}
if ($show) {
return true;
}
else {
return false;
}


texts: Displaying multiple node add forms using panels and contexts

texts:
I'm using panels to create a single page that will display multiple (different) node add forms. Within panels, I use contexts to activate the node add forms I'm using and then put the forms in as content. However, the resulting page shows only the first node add form and then displays "Form" and "Form goes here" in place of the Title and fields of the second node add form.

Is there a fix for this? Or another way to display multiple node add forms within a page?


texts:
I would like to add a form to the user account page, is there a specific way of doing this?

I guess this leads me to a large question: how can you embed forms in pages? I understanding using hook_menu & the drupal_get_form callback. But this creates a new page, what about adding forms to an already existing page.

I have a feeling the answer is here: https://api.drupal.org/comment/6679#comment-6679, but I can't seem to understand it. Anyone have any good suggestions or tutorials....


texts: If you were about to create a hierarchy of nodes that can have parents and children, which way would you go for? Using "References" module or the "Books" module that is included in the Drupal standard installation? And why please?


texts: Disable an option for the select form field

texts:
How do I disable an option in the select form field?

$form['feed'] = array(
  '#type' => 'select',
  '#title' => t('Display of XML feed items'),
  '#options' => array(
    'title' => t('Titles only'),
    'teaser' => t('Titles plus teaser'),
    'fulltext' => t('Full text'),
  ),
  '#description' => t('Global setting for the length of XML feed items that are output by default.'),
);

How can I disable, for example, the "Title only" option?


texts: Creating multiple nodes of different content type at once

texts: Can someone tell me if there is a module that will allow a user to create multiple nodes of different content types within one form?  I have a base content type that can have a 1 to many relationship to another content type. I want the user to be able to create the base content type node along with 1 to n nodes for the second content type.


texts: Do I have to set a default value to a variable in Twig

texts:
Normally in php I would have to set a default value to a variable but in Twig do I have to set a default value?

{% if content.my_field|render %}
  {% set offset = content.my_field['#items'].getString() %}
{% endif %}

<div{{ attributes.addClass(classes).setAttribute('data-offset', offset) }}>

I think it works but not sure if I should do this:

{% set offset = ''  %}
{% if content.my_field|render %}
  {% set offset = content.my_field['#items'].getString() %}
{% endif %}


texts: How to prevent the comment form from redirecting?

texts: I have a page with a View listing comments; the comment form is also in this View. After submitting through the comment form I get redirected to the actual comment, however I would like to stay on the same page that the View is on and not get redirected. I have tried using a number of Ajax modules (Ajax Comments, Asaf etc) with the comment form to prevent the redirect. But for some reason when these modules are installed the comments are no longer saved in the database when submitting the form. I have also tried to use Rules module to trigger a redirect if a comment is saved. However because I need to redirect to the previous URL I'm not quite sure how to input this as a token. Also, since this URL is different depending on which user is logged on I cannot make it absolute. I am using Drupal 7. How could I do this?


texts:
After hours trying to figure it out, no way ! What am I doing wrong ?

function alter_appointment_message_form_node_form_alter(&$form,&$form_state,$form_id)
{
     if($form['#node']->type=="appointment_request")
     {
       drupal_get_messages('status'); // Flush default simplenews status message
       drupal_set_message(t('An appointment has been requested'), 'status');
     }
}


texts: Can i port theme settings also in a feature

texts: I tried to port a theme settings like default theme, other theme settings in a feature. But when i enable this feature along with the theme on a new website. It does not take effect.


texts: Does drush sql-sync support inter-db syncing?

texts: Can I use drush sql-sync between MySQL and PostgreSQL?


texts: Uninstall module for which an update is pending?

texts:
I have a module for which an update is pending (drush updatedb). Unfortunately the update fails, blocking other updates of course (since it seems impossible to update selectively).

Is it safe to I pm-uninstall the module? Will this automatically delete the pending update? Or do I risk ending up in an even worse limbo?

[ As noted in the comments, taking a database dump and then restoring if anything goes wrong is an option; I'm still curious if there is a general rule about uninstalling while db updates are pending) ]

(BTW the module is service_links)


texts: Why would my Cron run fail when run by system crontab, but succeed when run manually?

texts:
The Cron tasks on my website run perfectly fine if I manually execute cron. However, I have the server set up to automatically run cron every hour. When cron is executed automatically it fails... every time. The error message is always about memory usage exceeding the allowed levels (which are already rather high). Most of the time, though not always, this error is thrown from the Date module. I do have a feed set up that pulls from a large Google calendar, so I've been thinking that might be the problem. But why would it succeed when run manually? I understand that when run manually it's run as my admin user, and when run automatically it runs (correct me if I'm wrong) as an anonymous user. Does that have something to do with the failure/success pattern?

Edit: Posting the actual cron command as requested

/bin/php5 -q /path/to/my/account/public_html/cron.php


texts:
I am using Youtube module and colorbox.  I have a content type with a youtube thumbnail in the teaser.  If you click on it, I would like it to open in a colorbox with dimensions 420x315.  Instead it opens in the full browser window.

I have youtube colorbox module installed and enabled, but when I got to  configure the thumbnail, it mentions colorbox but not youtube-colorbox.  Don't know if this could be the problem.

I've tried linking the thumbnail to both colorbox and youtube but I get the same result in either case.  I am Drupal default Field template for the thumbnail.

Any ideas how I can get this to open in a colorbox?


texts: Views exposed filter - Replace '-Any-' by Select All

texts:
I have a view with an exposed filter of taxonomy terms. Because I'm using charts, when I select the option '-Any-', the chart gets messed up. I noticed that, if I select all terms available instead of '-Any-', the chart looks ok.

So my question is, it is possible to replace the '-Any-' with a select all or, in some way, force the any to select all?


texts:
In Drupal 7, we can quickly change the base URL of the website.
How can I do this, in Drupal 8?


texts: Image styles not being created ( sometimes )

texts:
I am creating a node programatically which has an imagefield with 16 images attached.  Each image is a blank PNG of about 1000px by 768px weighing in at about 5KB.  The node displays fine.

On a separate path I have a View that displays the images attached to the node using a image style to shrink each images down to about 250px by 150px.

Sometimes when I first use the View to display the node maybe 5 (say) of the styles are not successfully generated. For each unsuccessful attempt I see a watchdog entry "Failed to create the style directory" followed by "Unable to generate the derived image located at ....".  However the other 11 image styles are successfully generated in the correct directory.

Typically if I then hit the browser refresh button the broken image styles are then successfully generated.

This is Drupal 7.30 on shared hosting.

What is wrong ?  Thanks.


texts: How to add autocomplete filter to a views based on webform results?

texts:
I have a views that lists webform results. There are some fields such as name, e-mail address, city etc comes from webform submission.
I want an exposed filter to filter the views based on city. This can be done and a search input appears at the top of the views but there is a problem: you should enter the full city name and then submit. There is no autocomplete or select list feature.
There is a module called Views Autocomplete Filters for this purpose but doesn't work with webform results data.
There was a sandbox project called Webform Selectable Filters before but doesn't exist now.
So, how to add an autocomplete exposed filter to a view that is based on webform results data?


texts:
Using Drupal 6. Views 2.

After googling a bit I found this module which does exactly what I need http://drupal.org/project/views_or, combine 2 exposed filters into 1 single "search box". However, it doesn't work for Views 2.

Anyone know of any alternatives? I want to allow the user to search for terms, both in the title of the node and the taxonomy tags.

Thanks


texts: Creating a page.tpl.php template for a group of pages (Drupal 7)

texts:
I have a special part of my site that needs a very different kind of layout from the rest of my site.  I have created a template file called page--special.tpl.php that implements the kinds of themeing I need.  This page works fine as the long as the page that is being viewed is at the endpoint ?q=special but I do not want to have to make a different template for each page in this special section (all of which would have the same theme code).  Is there anyway to have all pages that have endpoints starting with ?q=special use this template?

Is there some other better way to do this?


texts: How to generate URL per image in colorbox

texts:
I have a multiple image field that displays as a colorbox gallery. Is there a way to generate a URL per image? For example, if you click image 1, a unique URL will appear on the address bar, then another unique URL for image 2 and so on. This is so I can copy the URL and when I paste it on another browser or tab, the page loads and the particular image associated to that URL will pop up.

I have searched everywhere and did not find a solution for this. I hope to find the answer here! Thanks in advance!


texts: How do I list all blocks with PHP enabled inside?

texts:
I added a custom block that uses PHP, and now I get the following notice message:

  Trying to get property of non-object in eval() (line 5 of /public_html/modules/php/php.module(80) : eval()'d code).

I am trying to find which one is causing that notice, and since I have many blocks, I would rather do it without using the user interface.

Is there a way to get a list of blocks using PHP? I would be happy also with a solution using the Views module, as long as I don't need to look at the settings of each block, one by one.


texts: Way to allow instantiating derived classes

texts:
I have a class called MyService, a function to get the only instance of it custom_get_my_service(), and multiple functions a,b, etc that call the instance getter, as you can see below.

All of this is packaged into my module. Suppose I give this module to another developer, he can't change the code, but he needs to override some of my class methods, and all the custom_a, custom_b functions have to use his derived class.

How can I modify my custom_get_my_service() function, in a Drupal best practice way, to allow others to instantiate their derived class instead of my own?

class MyService {}

function custom_get_my_service() {
  $service = &drupal_static(__FUNCTION__, NULL);
  if (is_null($service)) {
    $service = new MyService();
  }
  return $service;
}

function custom_a() {
  $service = custom_get_my_service();
  // Do stuff
}

function custom_b() {
  $service = custom_get_my_service();
  // Do stuff
}


texts: Definition join on field and where other field has value

texts:
I am building a views plugin and I need it to do this:

LEFT JOIN my_table mt ON (mt.nid = node.nid AND mt.value = 'some argument');

I have found documentation for creating a views plugin, but all of the documentation that I have found doesn't say anything about creating view joins like this.

Is it possible? If so, how do I go about doing something like this?


texts:
I need to order my field in a node_preprocess to display it in a ul.

I have this field:
body,
field_cover[image],
field_gallery[2 imgs with title..],
field_video [a link list.. rendered with videojs module],
field_video_desc [a text field..]

I need to render they in 2 lists:

function mytheme_preprocess_node(&$variables){

  $rendered_field = mytheme_field_HTML($variables);

  $element = array (
     $rendered_field['field_cover'],
     $rendered_field['field_gallery_0'],
     $rendered_field['field_gallery_1'],
     $rendered_field['video'] );

  $text = array (
     $rendered_field['body'],
     $rendered_field['field_gallery_0_title'],
     $rendered_field['field_gallery_1_title'],
     $rendered_field['video_desc'] );

  $variables['elements'] = theme_item_list(array('items' => $element, 'type' => 'ul'));
  $variables['texts'] = theme_item_list(array('items' => $text , 'type' => 'ul'));
}

but I need to write mytheme_field_HTML() function and I don't understand how, using Field API, I can retrive the HTML according the default field display used in the current node.

How can I achieve this?


texts: 'Text format field is required' error when saving Better Exposed filters (BEF)

texts:
For one of the views exposed filters I'm using BEF but when I'm trying to save one of the filters as checkboxes/radio buttons it give me below error. I've no clue to what I'm doing wrong.

Any help would be much appreciated.


texts: Insert an article and fields with db_insert function or SQL

texts:
I want to add an article to the db using db insert along with its field like tags and image.

A sample code i tried(below) is adding data to the db but I can't find any entry in the

db_insert('node')
  ->fields(array(
    'title' => "hello world",
    'created' => REQUEST_TIME,
    // 'body' => 'you did it!',
    'uid' => 1,
    'vid' => 5,
    'type'=>'article',

  ))
   ->execute();

If not this, can it be done using a normal sql query?

Why I want to do this way instead of nodesave?

I don't want any hooks working on this process.
This is a temperory fast solution I want for a project.


texts: Inline Entity Form - IEF - Hook Form Alter - Ordering

texts:
I've got a module that I'm developing (I'm admittedly new to module development) - where I'm appending a date to the IEF fields displayed.   It looks like this so far.

function customized_inline_entity_form_table_fields_alter(&$fields, $context) {
// Make sure there's a stock field on each of the allowed product types.
$is_tender_detail = FALSE;
foreach ($context['allowed_bundles'] as $bundle) {
  if ($bundle=='rate') {
    $is_rate = TRUE;
  }
}
if ($is_rate) {
  $fields['field_rate_dates'] = array(                   // This part adds the body field with a label 'description'
    'type' => 'field',
    'label' => t('Dates'),
    'weight' => 101,
  );
}

}

So far - so good.  I want to display the relevant dates in field "field_rate_dates" - and they're displaying in the table.

Where I'm getting hung up is - IEF appears to be rendering the order randomly.  I would like to output the order by the date I'm appending there ("field_rate_dates") ASC - and I've been unable to find any hints on how to get that done.

Any help would be greatly appreciated :)


texts: Search for duplicate or similar node titles when creating content?

texts:
Much in the same way that it is on this site (as you type your question, it shows similar questions) is there a module that will search for similar nodes as I type the node title in Drupal?

I know of the Unique Field module, however it only checks after the node has been submitted. I need some way of doing it as they type.


texts: Cant make profile2 fields visible to other users

texts:
How can you make a profile (from the profile2 module) visible to all visitors?

I've given all users permission to "View user profiles". When viewing a user's page the fields from core are visible (username and picture). However the fields I've added with the profile2 module are not visible.

The profile2 fields are only visible when a user looks at their own profile, or when the administrator views users profiles. This seems like a permissions issue but I cant see what permission to change.


texts: Want to generate csv of a view programmatically in drupal 7

texts: I have a view in drupal 7 and I want to generate a csv of this view programmatically after click any button.


texts:
I upgraded my Drupal site from 6.22 to 7.8 (before that i had upgraded from 5.9 to 6.22).
After I start to run the update I had an error before it's started, apparently related to language:

Additional uncaught exception thrown while handling exception.
Original

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;TheBIgBrother.languages&#039; doesn&#039;t exist: SELECT * FROM {languages} ORDER BY weight ASC, name ASC; Array ( ) in language_list() (line 2513 of /mounted-storage/home106a/sub008/sc63415-EWDY/bigbrother-israel.co.il/includes/bootstrap.inc).

Additional

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;TheBIgBrother.languages&#039; doesn&#039;t exist: SELECT * FROM {languages} ORDER BY weight ASC, name ASC; Array ( ) in language_list() (line 2513 of /mounted-storage/home106a/sub008/sc63415-EWDY/bigbrother-israel.co.il/includes/bootstrap.inc).


texts: Views Infinite Scroll doesn't hide pager

texts:
I need infinite scrolling for a View.  I installed Views Infinite Scroll, and it will work if I set jQuery Update to version 1.8, but when it loads the next page, it leaves the pager in plain site.  I don't want the pager to display, and I can't figure out how to disable it.  Also, when it's loading the next page of content, it displays that ugly progress GIF.  Is there a way to hide that as well, and just get a nice scroll functionality, like on Twitter?

I don't know if this is causing an issue, but my View results are nodes, using Display Suite view mode.  In these nodes, I have another View that displays product pricing and other fields, using Commerce Add To Cart Extras.  Would this other View (in each node) conflict with the Views Infinite Scroll module for my main View?

If I have to do this through code, what is the best route?  Should I use the Views Ajax API somehow, or is there another JS or jQuery library that I can integrate with Views?

I tried to use the Views Load More with Wayports, but I couldn't get that to work either.  The best I got was the View to just display the "Load More" link, which I don't want.


texts:
How to print Date Field in Views in format "time ago" for "end dates"?
If I config field in views like:
Display: End date only,
Formatter: Time ago.
I get duration form Start date :(

Example for today (7 jun 2014).
date field values: start 1 jan 2013, end 1 jan 2014.
I wanna get: Expired - 5 mounths and 7 days.
But views printing: Expired - 1 year, 5 mounths and 7 days.


texts: CKEditor not displaying in latest 8.0.x-dev version

texts:
After updating Drupal from version 8.0.0-beta7 to version 8.0.x-dev — to fix text_format fields not submitting their value due to a missing name attribute —, my field is now displaying as a basic input field with the format bar under it.

Here's the code that defines the content field of my entity (inside the baseFieldDefinitions method):

$fields['content'] = BaseFieldDefinition::create('text')
  ->setLabel(t('Content'))
  ->setDescription(t('The content of the block'))
  ->setSettings(array(
    'max_length'  => 1024
  ))
  ->setDisplayOptions('form', array(
    'type'   => 'text_format',
    'weight' => -6
  ))
  ->setRequired(TRUE)
  ->setDisplayConfigurable('form', TRUE);

As said above, this code works fine on the latest beta but breaks on the latest version from GitHub.

Expected result (8.0.0-beta7):

Obtained result (8.0.x-dev):

I had submitted a bug report, thinking this was a bug, but apparently it isn't. I was told I need to use a textarea for the editor to show up. The thing is... text_format defaults to a textarea.

I'm guessing there's something I'm not doing right here, but after hours of searching, I just can't seem to understand what. I've tried changing the type passed to BaseFieldDefinition::create() to string_long, too, but then I just get a textarea with no format.


texts: Use sass variable and mixins from base theme in sub theme

texts:
I need some help regarding sub theming with sass. The sub theme setup is as follows :

There is a base theme base which has sass variables and mixins defined.
I run grunt and compile the sass.
There is a subtheme of base called microsite with similar sass structure as base but no styles as presently it uses only the base styles.

Q. How do I use the sass variables and mixins defined in base theme inside microsite theme?

Eg - 1 : Inheriting the base color palette.

I have a color palette defined under base theme with my color variables. themes/custom/base/sass/core/variables/_palette.scss

I want to use these palette variables in defining styles in my microsite subtheme at themes/custom/microsite/sass/base/color/_buttons.scss.

Eg - 2 : Inheriting the base gradient mixin.

I have a linear-gradient mixin defined under base theme at themes/custom/base/sass/core/abstractions/_linear-gradient.scss

I want to use this mixin in defining styles in my microsite subtheme at themes/custom/microsite/sass/base/color/_buttons.scss.


texts: Multiple shopping carts in one sessions per user with Undercart marketplace

texts:
We have a marketplace with multiple vendors offering their products for sales. The specific business model for these people requires the website to offer a seemingly continuous and seamless "add to cart" experience from the user's perspective but at the same time shows separate carts for each vendor the user is buying from and then issues separate invoices for both the users those vendors (each vendor is treated totally independent of the others).

We tried our best to implement it using a single cart but it seems rather unfit to do so. I thought in reality multiple buying sessions are run so we need a system which automatically creates separate carts (per each vendor the user is now buying from).

Ideas ?

I'm on Druapl 6


texts: Why does Git in Cygwin complain about info/refs not being found?

texts:
I am learning to use git with Drupal. I'm using Cywgin (Windows-based Linux command line), and trying to follow Practicing patches. The documentation tells me to use the command:

git clone --branch master http://git.drupal.org/project/current_content.git

However, I appear to have an old version of Git, because it tells me that "--branch" is unknown. The Git troubleshoot page explains a work around:

git clone [project_url] [directory]
cd [directory]
git checkout --track origin/[existing_branch_name] -b [tracking_branch_name]

However, the first line tells me:

fatal: http://git.drupal.org/project/current_posts/current_posts.git/info/refs
 not found: did you run git update-server-info on the server?

Any suggestions on what I am doing wrong? I've got the last version of git via Cygwin.


texts: Why does updating the description of a custom block not update the block title?

texts:
When creating a custom block, an editor is required to complete a description field. The description is then used as the block title (if displayed), as well as being used also for admin purposes on the block layout page.

If the description is later changed, the block title does not update and to do so requires a separate action of also updating the block configuration.

This seems like bad UX and is very confusing for editors.

Is there a valid reason for why blocks work like this?


texts:
The code is taken from the "Form API examples" and supplemented. There must be a pair of first and last name fields. A button “Add more” should add a new pair of fields “name and surname” below the existing one. This works (a little later using css so that they are on the same line), but they are grouped incorrectly. They are displayed following this order.

Name
Name
Name
Surname
Surname
Surname

I need to get them in the following order. (Using CSS, I will inline them.)

Name
Surname
Name
Surname
Name
Surname

What am I doing wrong?

The code I am using is the following one.

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['description'] = [
      '#type' => 'item',
      '#markup' => $this->t('This example shows an add-more and a remove-last button.'),
    ];

    // Gather the number of names in the form already.
    $num_names = $form_state->get('num_names');
    // We have to ensure that there is at least one name field.
    if ($num_names === NULL) {
      $name_field = $form_state->set('num_names', 1);
      $num_names = 1;
    }

    $form['#tree'] = TRUE;
    $form['names_fieldset'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('People coming to picnic'),
      '#prefix' => '
',
      '#suffix' => '
',
    ];

    for ($i = 0; $i < $num_names; $i++) {
      $form['names_fieldset']['name'][$i] = [
        '#type' => 'textfield',
        '#title' => $this->t('Name'),
      ];
      $form['names_fieldset']['surname'][$i] = [
        '#type' => 'textfield',
        '#title' => $this->t('Surname'),
      ];
    }

    $form['names_fieldset']['actions'] = [
      '#type' => 'actions',
    ];
    $form['names_fieldset']['actions']['add_name'] = [
      '#type' => 'submit',
      '#value' => $this->t('Add one'),
      '#submit' => ['::addOne'],
      '#ajax' => [
        'callback' => '::addmoreCallback',
        'wrapper' => 'names-fieldset-wrapper',
      ],
    ];
    // If there is more than one name, add the remove button.
    if ($num_names > 1) {
      $form['names_fieldset']['actions']['remove_name'] = [
        '#type' => 'submit',
        '#value' => $this->t('Remove One'),
        '#submit' => ['::removeCallback'],
        '#ajax' => [
          'callback' => '::addmoreCallback',
          'wrapper' => 'names-fieldset-wrapper',
        ],
      ];
    }
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Submit'),
    ];

    return $form;

The form is rendered as in this screenshot.

The second part of the code where the code is processed

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values_1 = $form_state->getValue(['names_fieldset', 'name']);
    $values_2 = $form_state->getValue(['names_fieldset', 'surname']);

    for ($i = 0; $i < count($values_1); $i++) {
      $arr[] = $values_1[$i] . ' ' . $values_2[$i];
    }

    $output = $this->t('These people are coming to the picnic: @names', [
      '@names' => implode(', ', $arr),
    ]
    );
    $this->messenger()->addMessage($output);
  }


texts: index.php is added in front of paths for anonymous users

texts:
I have a new Drupal 8.0.4 site running on Nginx, and I just noticed that the paths for anonymous users have a superfluous index.php in front of them.

So instead of

mysite.com/node/123

I get the following when not logged in

mysite.com/index.php/node/123

I'm not entirely sure if it was this way since I started building the site, because I was usually logged in I might not have noticed it. But it could also have happened only since I upgraded Drupal core to the latest minor version.

My Nginx configuration is based on the official Nginx recipe for Drupal, with some small differences in the php-fpm configuration for PHP 7.

As mentioned in the comment by Sachbearbeiter, this seems to be an intermittent issue. I don't see it anymore now on my site, some days later.

Any idea what is causing the index.php to be inserted and how I can get rid of it at all times?


texts: Views: Use like operator in exposed search filter (Search: Search Terms)

texts:
In a view, I am using an exposed filter of keyword search (Search: Search Terms). The default behavior of the filter is to select exact matches. I need to have similar words also selected. For instance when the visitor searches for "paint", she should see "painting" or "painter" too.

Similar to the "LIKE" operator in mysql.


texts: Language switcher does not have current page query parameters

texts:
I have a custom block that shows a schedule. It also show arrows to allow the user to see next or previous days. For this I simply add ?date=DATE to the arrow link. Once landed on one of those pages that have a GET query parameter it is impossible to switch language without loosing your current date selection.

I searched and found many similar issues but all for Drupal 7.

Switching language loses the line item URL parameter

Language switcher (locale_block) doesn't keep query parameters

Since this part of Drupal have been completely rewritten, I need a solution for Drupal 8.

IMO I think it should be a bug in Drupal 8 core. I think the language switcher should know there is existing GET query parameter that need to be passed along the language links. I don't see any reason you wouldn't want to keep the GET params.

anyone has a solution to this problem?


texts: Index getting currupt ocationally, Have to Delete and Re-index every day

texts: I'm using Apache solr and some related sub modules for my search. Something mess-up in my search index all the time. Some times when I search for some keywords my search result page is empty, But I know there should be results for these keywords. Every time when I come across with this issue, I have to delete the search & solr index and re-index again. Then it'll fix, but again in a few days it'll mess-up the search. At-least is there a way to make this process automatically? I mean Delete and Re-index once a day, something like that.


texts: Reference dialog hyperlink configuration

texts: Can anyone please direct me on how to configure References Dialog so that instead of just returning the titles of my node as plain text, they are returned as hyperlinks?


texts: D7 form field #ajax callback not called on autocomplete field

texts:
I have an entity reference field, and I'd like to do some ajax so that when a value is selected for that field, some text is displayed in a div below the field. Since it's on a node edit form, I'm using a form alter hook:

/**
 * Implementation of hook_form_FORM_ID_alter()
 */
function mymodule_form_blog_node_form_alter(&$form, &$form_state, $form_id) {
  $form['field_video_reference']['#ajax'] = array(
    'callback' => 'mymodule_video_ajax_callback',
    'wrapper' => 'my-path-div',
  );

  $form['my_path'] = array(
    '#markup' => t('My path'),
    '#prefix' => '
',
    '#suffix' => '
',
    '#weight' => 6,
  );

  if (!empty($form_state['node']->field_video_reference)) {
    $form['my_path']['#markup'] = 'Token path: http://www.mysite.org/node/' . $form_state['node']->field_video_reference['und'][0]['target_id'];
  }
}

function mymodule_video_ajax_callback($form, $form_state) {
  return $form['my_path'];
}

The code works fine when a the form is displayed and the field already has a value.  However, the most likely use will be when the node is first being created, so I want this to trigger when a value is first added.  The problem is, my callback is not being triggered at all.  I'm following the first example in the "Javascript in Drupal" chapter in "Drupal 7 module Development," so from what I see, I it should be called when the field value is changed.  Does this not work for fields that are already using ajax to get a value in the first place (i.e. an autocomplete field like this one), or is there something else I'm  missing?

Thanks.

UPDATE: In case it is an issue with doing this on an autocomplete field, I added another test field that is a select list and attached the ajax to it as above, but the form is still not rebuilt when I select a value.


texts:
For ex. person A introduce person B and B register in drupal commerce/ubercart site.

Now I want give A 5 points that A can buy other products with him/her points.

How Can I do this in drupal 8?


texts:
All of our Drupal installations have a /tmp folder at the root of the installation (ie, in parallel with the core files).

What does Drupal use the temporary directory for?


texts:
Is there a way to install Drupal multisite feature (it needs access to http.conf and http.vhosts) on a Shared Hosting with shell access? It also needs to hosts projects with different databases.

I know there is a module named: Domain Access for share Drupal database with affiliated sites but this is not actual I want.


texts: Make link translatable in Admin from a PHP string in a tpl-file

texts:
In a custom user-login-block.tpl.php file i want to make a link in the Create an Account -button which links to /doctor/register. Here the link to the example page (you are redirected to this page from specific nodes who needs permission (by Content Access module).

How do i make this link in PHP so i am able to make it multilingual and translate it in Administration » Configuration » Regional and language » Translate interface to:

benl/doctor/register (for Belgium dutch site)
befr/doctor/register (for Belgium French site)

I think i need somehow the base_url because otherwise it gives the string from the restricted page (in this example benl/producten/injectables).

How do i manage this?

Update:

To make it more clear this is my HTML:

    <?php print t('Create an Account'); ?>

So where is written HERE THE LINK i have to insert the php-code.


texts: Alter core and add wrapper twig template

texts:
Our site has multiple block twig template in our theme (20+).  They are simple.   When the block is in the layout builder we need to add additional things (admin label, classes, etc), because nothing gets display when the block is empty.    I know we can modify each of our our templates, but we would rather move that logic into a block wrapper.
We are looking for all blocks to call a block-wrapper.html.twig (or something similar) before their suggested twig template.  Is there a way to alter Drupal's core logic?


texts: Blank pages or wsod on a recently migrated site to a godaddy server only after logging in

texts: Just recently I finished my friend's site on my local wamp server. Looks great on that server. Now I tried to migrate the site to a Godaddy shared hosting account. I was able to get it all setup with the database up to date and everything, but the second I log in the the backend of Drupal, it white screens. Again tried a different browser, the site came up fine until I logged into the admin again. At this point I can't get any page to load, not even the home page. I can delete my cookies in the browser to log myself out but that's about it. So stumped its not even funny...


texts:
I added a field image to my basic page and I set it to be displayed first. The problem is that the image still display after the field body.

How can I change the order in which those fields are shown?


texts: How to import title, description and image from website

texts:
I would like to have a "Facebook style link commment" feature in Drupal 7. When you enter a URL it will pull the page title, first 100 characters of the main website text and an image.
There is a module called "Facebook Style Micropublisher" but it's Drupal 6 only.
Any other ideas on how this could get accomplished?


texts: Multiple copies of the same content shown due to voting

texts:
I have made an image gallery using views. I want to create a vote option for each image. I used the Rate module and I've created a rate button which looks something like this

I used the yes/no widget and changed the option to this

In my gallery view I've selected the Content:Votes relationship and changed the
value type to options
and vote tag to normal vote

The problem is multiple copies of the same content appear in the gallery when the votes are increased. How can I fix this issue? or is there any other way to do this?


texts: I want to make changes to the Garland theme. But it seems the style.css file is generated. I tried to change style.css and put my css about "do not touch" clause ( under CSS Support ). It's not working. Style.css file in the theme folder is not imported on the fly? Can anyone help me out?


texts: Load all field collections of a given type

texts:
Currently I am using a query to load field collections of a specified type, but I wonder if there is a more drupaly way to do it?

$query = db_select('field_collection_item', 'fci')
  ->fields('fci', array('field_name', 'item_id'))
  ->condition('fci.field_name', $field_collection_name)
;

$result = $query->execute()->fetchAllAssoc('item_id');
$fcs = entity_load('field_collection_item', array_keys($result));


texts: Drupal 8 + Twig background-color -field select

texts:
How I do with twig this:

I got list -field where I got differents color:

black|Black

grey|Grey

black = background-color: #000;

grey = background-color: #eee;

When I select Black it will appear somewhere on the node or field.

Example


texts: use custom tokens on a webform email confirmation

texts:
I have written a custom module which defines some tokens. These tokens are used e.g. in Wysiwyg editor this way: [mytype:closing_date] (I have token_filter module)

Is it posible to make these tokens available also in the Webform module, and specifically in the confirmation e-mail that is sent after filling the form?

I tried %mytype[closing_date] but didn't work.


texts: Drupal 8 Webform - Change to Dev Version

texts:
I need to send emails in Drupal 8 Webform conditionally based on what the user has selected. I know this feature was added in the most recent release in  8.x-5.x-dev, but I have the beta branch installed (8.x-5.0-beta16). Is there an easy way for me to change to this version of the module, or am I out of luck?

Thanks,
Lisa


texts: How to set value to login form's submit via themename_form_alter

texts:
I have theme_form_alter function, I want to set input submit value with it too

function ivanco_form_alter( &$form, &$form_state, $form_id )
{
    if (in_array( $form_id, array( 'user_login', 'user_login_block')))
    {
        $form['name']['#attributes']['placeholder'] = t( 'Email' );
        $form['pass']['#attributes']['placeholder'] = t( 'Password' );
        $form['name']['#attributes']['title'] = t( 'Введите email, указанный при регистрации' );
        $form['pass']['#attributes']['title'] = t( 'Введите пароль' );
        $form['submit']['#default_value'] = t( 'Принять' ); // this line doesnt work((
    }
}


texts: How to distinguish radio and checkbox type in drupal

texts:
I have a content type which consists four types of fields. checkbox, radio, select, select multiple

I'm using field_info_instances('node','bundle_name') in my custom module to get filed info for my content type. I need this info to use somewhere.

My question is, how can I distinguish the checkbox type and radio type.same problem for select and multi select also.

Here is the output


texts: Custom facets return no results on search page

texts:
I have created a custom field to the node index of apache solr. Here is the code.

function myModule_apachesolr_index_document_build_node(ApacheSolrDocument $document, $node, $env_id) {
  if($node->type == "feature") {
    $support = db_select("custom_table", 'a')
        ->fields("a", array('Support'))
        ->condition('nid', $node->nid)
        ->execute()->fetchField();
      $document->addField('custom_field', $support);
  }
}

And then for this custom field I have created the facet. Here is the code.

function myModule_facetapi_facet_info(array $searcher_info) {
  $facets = array();
     $facets['custom_abot_support'] = array(
      'label' => t('Custom Facet'),
      'description' => t('Filters by Support'),
      'field' => 'custom_field'
    );
}

The facet successfully created and it has been present in the facets list. But the problem is on the search page. When I try to search some thing, on the search results page this facet only display the title of the facet block. It does not display any content.

Any one what is the problem?


texts:
I have uploaded a banner onto my site, and it is not displaying correctly; yet, the content type it appears correctly in my browser.

It appears as though the black areas are not rendering correctly, as shown in the image below.

I have tried both .GIF and .JPEG.

This is the first time it has happened with over 100 banners, and I have even used this same image before.

This image shows the GIF settings.

It seems to be an issue with the scale and crop functionality of Drupal image toolkit, where the transparency of the image gets changed.


texts: What does the rule event mean "Drupal is initializing"

texts: What does "Drupal is initializing" mean as a rule event?


texts: How to display Commerce Pricing Attributes in Views?

texts:
We are using the Commerce Pricing Attributes module to create products with price-modifying attributes. I have set up a view to display line items with attached pricing attribute fields, but the pricing attributes are not rendering in the view display.

What is the proper procedure to display Commerce Pricing Attributes in Views?


texts: How do I mark a database query with a tag?

texts: How do I mark a database query with a tag so that I may alter it via hook_query_alter? I get the concept, but does anyone know what the syntax is? A working example would be helpful. Thanks.


texts:
I have three content types :
Content type A
Content type B
Content type C

B has a node reference to A.
C has a node reference to B.

I have also 2 roles :
Role 1
Role 2
Role 1 is belong to Content type B.
Role 2 is belong to Content type C.

I'm creating a view list in which

1) Content type A (nid) is passed from URL. Filter nodes of type B with nid of type A. ( done with contextual filter )
2) Criteria content type == B ( done with criteria )
3) Join content type C with content type B. ( done with relationship )

I have successfully got a list with above three.

But I have one more thing to do :
If logged-in user is Role 1, I want to filter nodes of type B of the logged-in user.
If logged-in user is administrator, show all nodes of type B which is filtered with node of type A.

How can I do that ? I'm using D7.7

[Edit]
I think filter criteria don't need for user role. It can be done with user filter for content type B. But I can only select all users associated the type B. I cannot select the current logged-in user id from views filter.
I may need to use this module : http://drupal.org/project/viewsphpfilter
Unfortunately, it has no update for D7.


texts:
while customizing front page i can not find 'Content: User' to add author name field in views. but i can find something like Content: Author uid how to show author name in front page?
another question i cant add new fields while selecting grid view, how to fix it too.


texts: Why does Drupal jump back to the calling function after submitting a form?

texts:
Dear Drupal community,

I am pretty much lost with the form listed below. When calling the form funnyform via the function funny_function (via the menu link 'Funny'), the form appears, and the word 'Fun' is displayed as I programmed. Now, when I click on the 'Resume' button, the word 'Submitted' is obviously displayed. However, the word 'Fun' appears as well. Apparently, Drupal goes back into this function once again! Now, this is very bad news because in my "real-life" this function contains additional programming code which is then run twice...

Can anybody please help me how to stop Drupal from going back there? And explain to me why it even does so??

Thanks and best wishes, Tobias

$items['funny'] = array(
  'title' => t('Funny'),
  'page callback' => 'funny_function',
  'access callback' => TRUE,
  'type' => MENU_NORMAL_ITEM,
);

function funny_function() {
  drupal_set_message('Fun');
  return drupal_get_form('funnyform');
}

function funnyform($form, &$form_state) {
  $form['information'] = array(
    '#markup' => t('Nothing'),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Resume'),
    '#weight' => '100',
  );
  return $form;
}

function funnyform_submit($form, &$form_state) {
  drupal_set_message('Submitted');
  $form_state['redirect'] = 'another_funny_page';
}


texts: Seven Sub-theme shows Branding and Nav instead of Local Tasks / Admin Menu [8]

texts:
My client wants some basic changes to the Drupal admin pages (yay!) so I'm trying to create a sub-theme of the core seven theme.  I have my sub theme working and my css is being loaded, but the local admin menu normally shown in the header of the seven theme had been replaced by the branding block and main navigation from normal pages.

Here is my info.yml file :

name: My Admin
type: theme
description: A sub-theme of the seven admin theme.
core: 8.x
base theme: seven

libraries:
  - my_admin/global-styling

and libraries.yml :

global-styling:
  css:
    component:
      css/style.css: {}

I've tried copying seven.theme file to my sub-theme folder and renaming the functions with my theme name (which has an underscore), but no love there. Any ideas how to do this properly ?


texts: Where do I find the Facebook application id for the the fb_social module?

texts:
I just installed the fb_social module. Now I need to set up the module which requires the Facebook application id.

Under the field reads: Get the ID of your facebook app or create a new facebook app : here.

But the link drive me to the main page of my facebook account.

Where is the right place to find it?


texts:
so I have a content-type X and some nodes of this type. If I go to the node page, I'd like to not see the label of an empty field. Where in the display options can I change that?

In my case ,the content of the fields are some check-boxes (from a vocabulary). I'm on D7.


texts: Access variables populated in one page function for a different page function? Always null

texts:
I have a module that creates a simple page. However in the page I want to link to iframes that I will generate in the module code.

Currently I have two hook_menu items: one for the simple page (no arguments), one for the iframe pages (with arguments).

However when I show the iframe, I need to get some values from a global variable that is populated from the simple page function but when I reference it in my function for the pages with arguments the variables are always null. I assume this is because drupal re-loads the .module page but skips running the simple page function when it loads the page with arguments, thus it doesn't populate the variables when it loads the iframe.

How could I populate my iframe with the variables from my simple page? Is there an easier way than what I'm doing? Can I do it without global?

Does that make sense?

function my_custom_page() {} for:
    drupal/my-custom-page-module

function my_iframe($id) {} for:
    drupal/my-custom-page-iframe/0

Code for drupal/my-custom-page-iframe/0 needs to get variables that were generated in function my_custom_page() {} when it runs the my_iframe($id) for the page callback.

I have defined the variables outside functions as global and included global var_name in both functions but it still doesn't work.

Also, the iframe should not have any Drupal theme/sidebar content: for this I'm just echo'ing my code and then return: within my_iframe{$id}.

What I was thinking was instead of using two functions with page callback, was to just use GET request for my 'iframes' like ?iframe={$id}. Does that sound like a better direction to go?


texts: How to capture the SQL on database errors

texts: Is there a way to capture the SQL that was submitted to the database when the database throws an error?


texts: How do I enable the PHP filter only for webforms?

texts: How do I enable the PHP filter only for webforms, and not other content types?


texts: Create link to users created content only

texts:
I have a content type Business, When a user creates a business and then signs into the site, I have a link called "my business" that when the user clicks on i want it to take them to only their created business.

Not sure what to "link" too for this to happen.


texts:
I am using Views PDF Module in my project.

This module provide only limited settings for table layout i want to generate pdf according to custom design as given below:

The pdf file generated through views PDf module currently as below:

so, please tell me how to design my pdf table in Views PDF Module.


texts: I use the "discount" module, I created a view to display my products but I can not find how to display the products on sale first in my view


texts: Drupal 7 Display a list of reference node in node being display

texts:
I am new to Drupal 7.

I have two content types, they are 'school' and 'course'. In course content type, I used Reference module to create a field that reference to school (a school have many courses, and a course is belong to one school only).

And now what I want is, when I view a specific school info, the list of courses that belong to the school also be displayed beneath.

How can I do that in drupal 7 ? :D
Thank you in advance!


texts: How to bind to AJAX complete event in regard to styling the AJAX button submit throbber

texts:
With this I can bind to the AJAX button submit event:

Drupal.ajax.prototype.beforeSend = function (xmlhttprequest, options) {
...
}

My question, how to bind to the opposite (i.e. when AJAX button submit finishes)? Thanks.


texts:
I have a question about configuring a player in the video module.

In the theme there's a video-play-html5.tpl template, which formats the JW Player.

The question is this--I've used the coding below, along with the pathauto module to change site logos based on content type:

    <?php
    // Return a file based on the URL alias, else return a default file
    function unique_section_header() {
      $path = drupal_get_path_alias($_GET['q']);
      list($sections, ) = explode('/', $path, 2);
      $section = safe_string($sections);
      $filepath = path_to_theme() . '/images/sections/header-' . $section .'.png';
      if (file_exists($filepath)) {
        $output = $filepath;
     }
      else {
        $output = path_to_theme() . '/images/sections/header-default.png';
     }
      return $output;
    }

    //Make a string safe
    function safe_string($string) {
      $string = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '-', $string));
      return $string;
    }
    ?>

The question is, can something similar be done to change the watermark in the JW Player based on video content type in the html5 player template?  (This is assuming that the function even goes in the template;  I'm still learning my way around drupal.)


texts: Set parent for programmatically created menu links

texts:
I'm currently programmatically generating a menu and menu links inside it. This is working but I'm having trouble setting the parents for the links. Here is my current code

    $langcode = 'es';
    if (empty($menu_id)) {return ['#markup' => 'menu not specified'];}
    $menu = \Drupal::entityTypeManager()->getStorage('menu')
        ->create([
            'langcode' => $langcode,
            'status' => TRUE,
            'label' => $menu_id,
            'id' => $menu_id,
            'description' => 'this menu was created programmatically',
        ])->save();

    $items = [
        '1' => 'item 1',
        '2' => 'item 2',
        '3' => 'item 3',
    ];
    $parent = NULL;
    foreach ($items as $id => $title) {
        if ($id == '2') {$parent = '1';} else { $parent == NULL;}
        $menu_link = MenuLinkContent::create([
            'title' => $title,
            'link' => ['uri' => 'internal:/node/' . $nid],
            'menu_name' => $menu_id,
            'expanded' => true,
            'langcode' => $langcode,
            'status' => TRUE,
            'parent' => $parent,
        ]);

        $menu_link->save();
        var_dump($menu_link->getParentId());
    }

This line

var_dump($menu_link->getParentId());

is actually displaying the correct parent. But when visiting the menu in the admin page the parent is not set and is at the top level of the menu. Is there a specific issue with my code? How would you set the parent of a programmatically generated menu link?


texts: How do I add a link to the category in menu?

texts: Now this might be a dumb question, but it's not obvious. Seriously. I have a menu with node/ID links as paths, but I also need one link to the category in the menu. I know that pasting in absolute urls or slugs is not a good idea. But how do I do it otherwise?


texts:
I have a Drupal 7 / Views question... I have a site with some data reports displaying in various graphs/ gauges etc. I also have a "Data" page that shows all of the data used so the user can look through it and/or even download it. My problem stems from the views table overflows past the screen on the right with data. This in itself is not a big issue, but I was wondering if there was a way to contain the view inside a fixed size box/container that is scrollable. Much like a text box.

Again, not that it would help the functionality but sure would make it look nice and clean.

Thank you in advance.


texts: Backup & Migrate not working because of perrmission settings? what should they be?

texts:
I'm unable to use the Backup & Migrate module because it's telling me the file permissions are not set correctly. i have tried various settings in the command line using chmod. i've removed rwx from users and group but it's still not working. can someone clue me in exactly how they should be set?

the folders used are files/private/backup_migrate/scheduled and then same for manual too.

neither backup option is working. thanks in advance!


texts:
Have been struggling with view and modal to display related node content for a few days, but in vain.

In view, a page is to display / list only thumbnail images (Display Suite) with rewritten link to trigger the modal with data-target. Then bootstrap modal code is placed in page.tpl.php.

So on view page, on click the thumbnail, the modal shows up. The problem is how to display title, body and images? Tried <?php print $node->title; ?> but when refreshing the view page, it shows blank page.

Is it not possible to display related node content of the thumbnail on modal?

Have tried Bootstrap modal and JQuery Ajax Load but they don't work at all. Documentation isn't clear either.

Help very much appreciated


texts: Creating dynamic pages for content-type/taxonomy-term

texts:
I have two content types:

news
review

I have a taxonomy vocabulary attached to them with following terms

tech
entertainment
other
(More may come)

I need to have a listing of these contents in following format:

tech/news (or news/tech)
tech/reviews (or reviews/tech)
other/news (or other/news)
other/reviews (or other/reviews)

..and so on.

I could create a page for every required URL pattern and create a separate view for each. But is there any dynamic way to do it in views?

At least, can I add a drop down filter for content type on term pages?

I'm using Drupal 6.

Thanks for any help. :)


texts:
I've got a Drupal site with a large amount of CCK fields already populated. I'd like to allow non registered users to be able to submit a particular content type, but I don't want all the fields to be available to them.

I can, obviously, use Content Permissions to do this, but I have 100+ fields that I would need to set individual permissions for, and would also need to set permissions every time I added a new field.

Is there a way I can set default permissions for all fields? So, for example, all fields are editable by admin and viewable by all.


texts: Need to autofill content type field based on other field of form

texts:
Story:
I have three content types.
Category
Project
Tasks
I have "Project Manager" field on Project content type, which is an entity referrer field.
On Task content type i have three fields
Category
Project
Project Manager

Requirement:
i need to auto fill Category and Project Manager field when i select Project.


texts: Get logged in user's username as twig variable

texts: Is there a way to get the currently logged in user's username as a variable to use in any twig template?


texts:
Existing site drops me back into the install routine and when I succumb and try to go through the install, it tells me:

I need to create a sites/default/settings file when it already exists; even when I delete that and create a new one, I get the same error message
Similarly, it says I need to create a sites/default/files directory, even when it already exists; when I try to delete the old one and start over I get a bunch of denials and when I try to change the properties, I get a bunch of messages telling me I can't do that.

Do I have to scrap the whole site and start over? Hopefully I can keep the Drupal DB which has some newly-created content pages.

And while we are at it, when I set the properties for a file or folder, is Drupal considered the Owner, Group, or Other?


texts: Multi-value image field hangs browser on upload and remove

texts:
I have a content type with a multi-value image field set to unlimited.  My client finds that they cannot either remove an existing image or upload a new image to a node which about 60 images loaded because Firefox just hangs ( spinner stops moving ) and in IE it reports 'A script on this page is causing Internet Explorer to run slowly'.

If I log onto as the same user it works OK for me.  Their Internet connection isn't superfast but it isn't satellite, and should be about 1MB.

Nothing is reported in the Drupal log.  Cealrly there is an issue with the AJAX update but why does it work for me and not for them ?

Any suggestions appreciated.

Elb


texts: Let Gmap center on the users geolocation, but still load all the node markers onto the map

texts:
For a website I am building I have a used a map to display all the nodes inside my country, by using a view. When the map is loaded, it shows the whole country (by standard settings in the Gmap module).

What I would like to do having this map centered on my location, but still show/load all these node markers that are spread across the map.

I manage to have the map centered on my location by using Filters and SmartIP in the view, but offcourse this limits the loaded nodes to only that location. I do not want to filter anything, just center the map. I am new to Drupal, and can't figure out how to make this work.


texts:
I have a rest export view and this is my output:

{
  title: "about",
  view: "[{"id":7,"field_history_json":7,"field_history_text":"sdfsfsdffd","field_history_year":3244}]"
}

My field "view" is a string and I need this to be an object/array, like this.

{
  title: "about testes",
  view: [
    {
      id: 1,
      field_history_json: 1,
      field_history_text: "sdsdfsfsfd",
      field_history_year: 234
    }
  ]
}

Like I said I have a rest export view of "About" content type.
"About" content type has a paragraph field.
Paragraph field has 3 fields (text, year and file).

I also have a rest export nested view, this view has paragrpah fields that I want to display.

I import paragraph view (rest export nested view) to my first view ("About") and display it with "Views field view" module.

That's how I am getting output as string.

Is there a way to convert string to JSON object in Drupal 8?


texts: Hook D8's Search API query to filter results by field from session or parameter values

texts:
I am using Search API with a simple database server to index a relatively small amount of data from 3 content types.

I'd like to offer users a separate select field to further filter search results and fallback on a session value when omitted.

How can I hook the search API query to set a field filter value?


texts: Views pager not rendered for teasers with comments

texts:
I have a views which displays teasers. Pager is also set.

When comments in teasers is enabled pager doesn't show up, however it does when comments are turned off.

I cannot figure out what the issue might be, please anybody any clue to this?

Thanks.


texts: How to translate Global:PHP in the view?

texts: I need translate view's global:php in the no results behaviour,Can i do that?


texts: URL in link field adds duplicate parameters in query string when using an internal relative path

texts:
Newbie Drupal 8 user using a link field to add url's like:

/samples/products?f%5B0%5D=market%3A1

when saved makes the actual link /samples/products?f%5B0%5D=market%3A1&f%5B1%5D=market%3A1&f%5B2%5D=market%3A1

It's really /samples/products?f[0]=market:1 encoded so maybe the link field doesn't like this? Adding links like this in other places like in wysiwyg editors work fine it seems that the link field is adding two more times.

Any ideas on where that might be happening? Could there be a bug in link module or is there an issue with using internal url's this way? Any help would be greatly appreciated. Thanks!


texts:
On the forum I made a quote using the Quote module. It works fine for the administrator, but it doesn't work for the anonymous users.

The module defines a function, called via an ajax request, which filters the text before passing it to the editor, to prevent certain XSS attacks on content edits (that the JavaScript library might not handle). Because the function did not check a CSRF token for anonymous users, it was possible to perform reflected XSS against anonymous users via CSRF.

Quotes breaks the function module (line 229 in "ckeditor\includes\ckeditor.page.inc").

function ckeditor_filter_xss() {
  header('Content-Type: text/plain; charset=utf-8');
  $GLOBALS['devel_shutdown'] = FALSE;
  if (!isset(
$_POST['text']) || !is_string($_POST['text']) || !isset($_POST['input_format']) || !is_string($_POST['input_format']) || !isset($_POST['token']) || !drupal_valid_token($_POST['token'], 'ckeditorAjaxCall', false)) {
    exit;
  }

I need to fix it.

Can I delete ckeditor_filter_xss()?


texts: What ways to attach a library to a form?

texts:
I created a custom form and I use a js library on it. I attached my JS in my template file but in a first time, I tried to attach it directly on my form with

$form['#attached']['library'][] = "mymodule/mylibrary"

like in D7 but it doesn't work.

I found none references to attach library directly to a form and no references to the "#attached" property so I suppose it has been remove.

My library works fine in the twig template file.

But in the case I don't used a custom template or I use various templates for various cases, can I attach my library directly to my form without pass by a hook function or must I pass necessary by the template file, a hook_preprocess or a hook_page_attachment?


texts:
I'm attempting to create a duplicate of an entity queue that includes all the nodes inside it.

Here is my current code

$entityQueueId = 'hero_images';
$langcode = 'test'
$clones = [];
$subqueue = \Drupal::entityTypeManager()->getStorage('entity_subqueue')->load($entityQueueId);
$nodes = $subqueue->get('items')->referencedEntities();
    foreach ($nodes as $node) {
         $clone = $node->createDuplicate();
         $clone->title->value = $clone->title->value . ' - ' . $langcode;
         $clone->set('langcode', $langcode);
         $clone->setCreatedTime(time());
         $clone->setChangedTime(time());
         $clone->save();
         $clones[] = [
             'target_id' => $clone->id(),
         ];
    }

    $subqueue_clone = $subqueue->createDuplicate();
    $subqueue_clone->set('name', $langcode . '-' . $subqueue->id() . '-' . uniqid());
    $subqueue_clone->set('title', $langcode . '-' . $subqueue->id() . '-' . uniqid());
    $queue = $subqueue->getQueue();
    $queue_clone = $queue->createDuplicate();
    $queue_clone->set('id', $langcode . '-' . $queue->id() . '-' . uniqid());
    $queue_clone->set('title', $langcode . '-' . $queue->id() . '-' . uniqid());
    $queue_clone->save();
    $subqueue_clone->setQueue($queue_clone);
    $subqueue_clone->set('items', $clones);
    $subqueue_clone->save();

The queue does get created, but there are no items within it. In case there was an issue with my node duplication code as a test I just set

$subqueue_clone->set('items', $subqueue->get('items')->getValue());

but that didn't work either. Is there an issue with my code? Or should I go about this in a completely different manner? What's the best way to duplicate an entityqueue while preserving or duplicating the list of the nodes inside it?


texts:
How can I simply add "#" as a menu link in Drupal 8? I want to have:

<a href="#" ... output as a menu link.

Do I have to define my own route token akin to <nolink> and write a custom LinkGenerator class to handle that case?

i.e.:

elseif ($url->isRouted() && $url->getRouteName() === '<nolink>') {
      $generated_link = new GeneratedNoLink();
      unset($attributes['href']);
    }
elseif ($url->isRouted() && $url->getRouteName() === '<hashonly>') {
      $generated_link = new GeneratedLink();
      $attributes['href']= "#";
    }

Or is there an easier place to do this without disrupting the render pipeline?


texts:
I'm trying to create a functioning sub theme of Omega 4.4. I've worked  with Drush before with it, but the site is on a host that I'm not administrator of. I've tried the Drush Webservice module but not succeeded in executing the Omega Wizard. In short, the Omega Wizard may be extremely helpful, but I can't get it to work.

Next, I've tried to manually create a sub theme using the instructions here. However, the results of this is a theme catalogue in the Themes-folder, but the theme not showing up in Drupal. Perhaps I'm using the wrong instructions for the wrong version of Omega?

Anyhow, does anyone have instructions for how to install an Omega 4.4 sub theme manually for Drupal 7?


texts:
I'm using Drupal 8 and I would like to allow free tagging my website. There should be a field on the node edit page for tags that the user can add new or existing tag(s) to the page.

What field should I use and how must I configure it?


texts: Theme Upgrade for an existing D7 site - block and config management

texts:
Working on developing a new Bootstrap theme for an existing D7 site.
How can I make sure that the blocks are assigned to specific regions when the new theme is installed.

Because I would be working in Dev where the theme config would be stored.(cannot update the prod db from dev).

Would really appreciate your inputs.

Thanks!


texts:
I am writing the script for a file migration and am using the MigrateDestinationFile method.  I noticed that when I migrate the files that they default to the Document file type.  However, I have created custom file types and want the files to be migrated to those file types.

How can I do so?

I was hoping I could do something like this, but it's not working:

$this->destination = new MigrateDestinationFile('custom_file_type');


texts: Saving form data of forms modified with form_alter hook

texts:
I understand how to add stuff like checkboxes and fieldsets to existing forms (e.g. the form displayed on the node edit page) using _form_alter. But what I don't understand is how to collect the input and store it in a database table of my choosing (ideally with db_insert). Let's say I've added a checkbox to the fieldsets at the bottom of article_node_form (the form which appears when editing content type article):

$form["Email Notifications"] = array(
    '#type' => 'fieldset',
    '#title' => 'Email Notifications',
    '#collapsible' => 'true',
    '#group' => 'additional_settings',
    '#required' => FALSE,
    'email_notify' => array (
        '#type' => 'checkbox',
        '#title' => 'Notify users of changes to this page',
        '#default_value' => 0,
        '#required' => FALSE,
)

How do I collect this data an store it in a database?


texts: How do I choose the "date_popup" widget for custom date field from code?

texts:
I have a custom field in a custom form element which is declared using the following code:

$element['data_da'] = array(
  '#type' => 'date',
  '#title' => t('Date from'),
  '#default_value' => isset($items[$delta]['data_da']) ? $items[$delta]['data_da'] : NULL,
  '#description' => t('Description for field Date from'),
);

When I insert data, I see three selects, one for year, one form month and one for day. I would like to use the "date_popup" widget.
How can I do that? What should I set?
Is there a '#widget' directive?


texts: Should separate Drupal installations have separate temporary directories?

texts: Assuming one installs several Drupal sites on the same server (i.e., with multiple top-level directories, not multiple sites under a single top-level directory), can these installations share the same temporary directory or should they each have their own temporary directory?


texts: custom module - can't remove field from a page

texts:
We have an interactive Drupal 7 website in which the user enters data in forms for a report.  I'm trying to have two fields on two separate pages no longer be visible to the user. I go to Structure>Content Types>Select the appropriate content>Manage Display>Select Hidden for the appropriate field.  We don't want to delete the field, as we have data in that field which we may want to access in the future regarding past reports.  This hiding of the field has NO affect.  The hidden fields on either Content Type are still visible and accessible.  I have tried finding the occurrence of the machine name of the field in the code and commenting it out.  Nothing works, and when I comment out the handlers it breaks the website and it is no longer accessible until I uncomment the code.

I have found nothing in the logs which seem useful to me.

I admit I have very little experience behind the scenes either creating or delving into the code, and have no idea what to do next.

Can someone please help guide me in the correct direction to work through this and to make these fields not visible to the users?  Thanks in advance!


texts: Multiple forms on the same page are causing conflicts?

texts:
I have the following code.

function mymodule_get_node_create_or_edit_form($nodeType = '', $inputNode = null, $prepopulationFields = array())
{
  if (empty($inputNode))
  {
    $values = array(
      'type' => $nodeType,
    );
    $values = array_merge($values, $prepopulationFields);
    $node = \Drupal::entityTypeManager()
      ->getStorage('node')
      ->create($values);
    $form = \Drupal::service('entity.form_builder')->getForm($node);
  }
  else
  {
    $form = \Drupal::entityTypeManager()
      ->getFormObject('node', 'default')
      ->setEntity($inputNode);
    $form = \Drupal::formBuilder()->getForm($form);
  }

  return \Drupal::service('renderer')->render($form);
}

I use this function to create edit forms for a node. So I can, for example, create a form that can be used to create a form:

print mymodule_get_node_create_or_edit_form('page', null, array());

Or I can get the edit form:

$node = node_load(1);
print mymodule_get_node_create_or_edit_form($node->getType(), $node , array());

The problem is if I execute both on the same page. Eg:

print mymodule_get_node_create_or_edit_form('page', null, array());
$node = node_load(1);
print mymodule_get_node_create_or_edit_form($node->getType(), $node , array());

If I now make changes to node 1, instead of saving it, it creates a new node with the changes I made, Instead of actually editing the existing node.


texts:
I created an module polls and entity poll using Drupal Console

I want to add default entity_type on installation.
Currently I added only one field to it field_image.

I created following files

FILENAME : field.field.poll.article.field_image.yml

langcode: en
status: true
dependencies:
  config:
    - field.storage.poll.field_image
    - polls.poll_type.article
  module:
    - image
id: poll.article.field_image
field_name: field_image
entity_type: poll
bundle: article
label: Image
description: ''
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings:
  file_directory: '[date:custom:Y]-[date:custom:m]'
  file_extensions: 'png gif jpg jpeg'
  max_filesize: ''
  max_resolution: ''
  min_resolution: ''
  alt_field: true
  title_field: false
  alt_field_required: true
  title_field_required: false
  default_image:
    uuid: null
    alt: ''
    title: ''
    width: null
    height: null
  handler: 'default:file'
  handler_settings: {  }
field_type: image

FILENAME : field.storage.poll.field_image.yml

langcode: en
status: true
dependencies:
  module:
    - file
    - image
    - polls
id: poll.field_image
field_name: field_image
entity_type: poll
type: image
settings:
  uri_scheme: public
  default_image:
    uuid: null
    alt: ''
    title: ''
    width: null
    height: null
  target_type: file
  display_field: false
  display_default: false
module: image
locked: false
cardinality: 1
translatable: true
indexes:
  target_id:
    - target_id
persist_with_no_fields: false
custom_storage: false

Field is created but it is coming as hidden in Form. How can I show it when modules get installed.

Please suggest.

--

Thanks


texts: Place two text fields within a single  class

texts:
I have assigned class names to both user name & password text fields in user login block separately like this and it's working.

function mymodule_form_alter(&$form, &$form_state, $form_id, $element) {
   if ( TRUE === in_array( $form_id, array( 'user_login', 'user_login_block') ) ) {
       $form['name']['#attributes']['class'] = array('mgnB10', 'fntXL', 'drkFg1');
       $form['pass']['#attributes']['class'] = array('fntXL', 'drkFg1');
   }
}

I want to include these fields inside a single '' and assign class name for design purpose, like this.

  username field
  password field

I am using the following code but I didn't get the expected output.

function mymodule_form_alter(&$form, &$form_state, $form_id, $element) {
   if ( TRUE === in_array( $form_id, array( 'user_login', 'user_login_block') ) ) {
       $form['user_login']['#attributes']['class'] = array('#prefix' => 'myclass');
       $form['name']['#attributes']['class'] = array('mgnB10', 'fntXL', 'drkFg1');
       $form['pass']['#attributes']['class'] = array('fntXL', 'drkFg1');
       $form['user_login'] = array('#suffix' => '
');
   }
}


texts: Getting "TypeError: $ is undefined" when calling drupal_add_js on an external file

texts:
I am getting "TypeError: $ is undefined" in Firebug when I call the drupal_add_js on an external jQuery file. If it were some local code, I would just wrap the code in a behavior function, like so:

(function($) {
    Drupal.behaviors.addStuff = {
     attach: function(context, settings) {
       // jQuery code goes here.
     }
    }
 };

I know that I'm supposed to change the dollar signs to "jQuery." but I can't do that to an external file (since I can't edit the code). How do I safely include this file? Note that this is just one module, I do not want to add it to my template file, and I do not want it to run on every page on my site.