texts: How can I get node url in rules for facebook auto post

texts:
Event is: After saving new content

When I add new blog type content it shows error. I know this error is occurred for

  Set a data value
  Parameter: Data: [entity-created:field..., Value: [node:url]

1. I know the problem is occurred  Value: [node:url]
2. But I need the url of the created node
3. how can I get this url


texts: Create exposed filter for Views PHP value

texts:
I have created a views field using the Views PHP module. This field converts a text date string into a date stamp, and now I need to create an exposed filter for organising the rows.

I add a filter "Global: Combine fields filter", and under "CHOOSE FIELDS TO COMBINE FOR FILTERING" I select Global:PHP to select my field, but the filter doesn't work, I just get the following error...

SQLSTATE[42000]: Syntax error or access violation: 1064
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax
to use near ') LIKE '2014-01-03') ))) subquery' at line 4

I need to create an exposed grouped filter for "Todays events", "Tomorrows events", "upcoming events". Is it possible to create a filter for a field rendered by views PHP?

I have searched loads of similar questions, but they have all gone unanswered. Can anyone help?


texts: How to set a coming soon page on drupal?

texts:
All request must be redirected to the coming soon page, is there any module can do it or a solution, I'm using the zen base theme.

Thank you for your help :)


texts: How to get slick slider working well on multi-directional(RTL/LTR) site?

texts: After install slick slider and Slick Views modules on multi-directional site, Slider does not work well on RTL, There is option in slick slider module for RTL sites, but this broke slider on LTR, So we need this an option enabled only on RTL sites, I found this solution. How can accomplish this?


texts: How to configure REST server to create new node from URL parameters?

texts:
Drupal   7.23
Services 7.x-3.5

I've followed the instructions for setting up Services module, including https://drupal.org/node/1699354. I got the endpoint setup successfully. I am able to retrieve index of nodes using ...endpoint/node and specific nodes using .../endpoint/node/#.

Now how can I create new nodes via Service through an URL? The Services manual gets really confusing at this point, is outdated and full of errors. The sample code they provide here https://drupal.org/node/1334758 ... am i supposed to put this in a custom module in order to be able to POST? If so, it turns my whole site blank right after adding this line:

// cURL
$curl = curl_init($request_url);

Also, there's an issue with CSRF validation, as showing in the Firefox Poster tool. The Services forum is a madhouse so I come here in hopes that someone can guide me in the right direction. What other modules do I need to get this to work? Why does my site go blank after adding the code above?

A simple solution would be the following:

domain/endpoint?title=test&url=http%253A%252F%252Fwww.example.com

and produce a new node of nodetype with a title and URL.


texts: List recent submission of the user using webform

texts: I am very new on drupal. i want to show all results of the users submitted by the any user on form page under the form. example image attached. can anyone let me know how can i achieve that?


texts: Views content show current state - workbench

texts:
I have a page that lists all the content and want to display the current state for each node.

But for now I can only see published content on the page. The view of mine is a content view.

Can we make some changes in the view to show current state of nodes as well?

Have tried the Workbench Current state filter as well but it did not work


texts:
In my case once I save node with images and images data(alt,title)I can see them in the view node. But after few hours I noticed those images missing with image data. When I check file_usage table I can see entries. But in file_managed table there are no particular entries.

This doesn't happen all the time. In some nodes it disappear all the images and in some nodes(same content type) it disappear few images only.

Images uploaded via image field.

How I can resolve this? Please help.


texts: Drupal & AJAXified links: hook into requests before they are sent?

texts:
I've got a link 'test/nojs' on a page. I've added the class 'use-ajax' to that link, so that Drupal automatically AJAXifies the link and replaces the 'nojs' part with 'ajax'. So far so good.

However, I'd like to hook into the AJAX request as there might be cases where I'd like to stop the request from being sent off to the server. However, I can't get it up and running properly.

One post say that I can do this by setting a 'hook' function in Drupal.ajax[element].beforeSend(a,b) and some places say that I can do it by settings a 'hook' function in Drupal.ajax[element].options.beforeSend(a,b). However, I can't get any of this to work.

Is there a "right" way of hooking into the AJAX process? Even better, is there a "right" way of hooking into the AJAX process for certain elements?


texts: Render content type via Form Block module using module_invoke

texts:
I am attempting to use the Form Block module so that I can place one of my content type forms in a block.  I seem to be able to get to the block but I'm not sure how to render it.  If I do a print_r($block) I see the block contents but I don't see anything to do with rendering it.

$block = module_invoke('formblock', 'block_view', 'csc_newsletter_subscription');

// Normally I would do something like this if it was just a block_view
$variables['newsletter_subscription_form'] = render($block['content']['#markup']);

And then I would be able to take the $newsletter_subscription_form variable and display it in my tpl file, but this does not seem to work.

What am I missing?


texts:
I am invalidating a cache tag in KernelEvents::REQUEST event:

public static function getSubscribedEvents() {
  $events[KernelEvents::REQUEST][] = ['onRequest', 100];
  return $events;
}

public function onRequest(GetResponseEvent $event) {
  if ($this->request->cookies->has('myValue')) {
    $this->cacheTagsInvalidator->invalidateTags(['my_tag']);
  }
}

When I refresh the page the tag is invalidated but the changes are showing on the next refresh, to which event/hook/etc. do I need to subscribe me to see my changes in single refresh ?

Edit 1:
I have 'Internal Page Cache' module installed. If I uninstall it, the code above works fine.

Edit 2: Added the if condition.


texts: How to embed Responsive Youtube video in Drupal Bootstrap subtheme?

texts:
I am trying to embed a Youtube video to a block using Bootstraps .embed-responsive-item class. The Text Format is set to Full HTML.

It’s working just fine on my static html version. However within Drupal the video canvas doesn’t use the full block dimension? What’s the correct way to embed full-size Youtube videos in a Drupal Bootstrap subtheme?


texts: Forms alter submit button callback not working

texts:
I have managed to override a profile2 form using hook form alter. After adding a second submit button to the form successful an issue arose. I can not get the call back function to work. Below is the hook and the call function. Can anyone see a issue with the code?

function multi_step_form_form_profile2_form_alter(&$form, &$form_state){
          $form['profile_x']['field_personal_info']['submit']['und'][0] = array(
            '#name' => 'personal_info_alt',
            '#type' => 'submit',
            '#value' => t('Info Save'),
            '#attributes' => array('alt' => t('get data')),
            '#submit' => array('testing_to_see'),
          );
}

function testing_to_see() {
  print'I am in call back ';
  exit;

}

Thanks for the responses. The reason I am trying to add another submit button is that the current profile page is using JQuery to hide and display some field collections that have been added to the profile page.

Currently when the user fills out the inputs in a fieldset and clicks next it only hides that fieldset and then displays the next fieldset.

Now each fieldset needs to save the data on the server each time you press next. So I found a way to add a submit button using the above code and to display the next fieldset by unsetting the array.

What I can't get the submit button to do when pressed is go to a call back function so I can manipulate the process to achieve this goal.

To answer the current questions below.

field_personal_info is adding the submit button inside the fieldset
multi_step_form is the name of the module


texts:
How do I add data into a table into my node--course.tpl.php?

I would like to mimic the table on this page where it has course ID and info:
http://cie.austin.utexas.edu/uex-cm/courses/acc-310f-foundations-accounting-online

to look like this:
http://uex.webhost.utexas.edu/coursedetails.cfm?OutID=3040

Should I use a view or a block?


texts: How to set Cron Job in custom module for specific time in Drupal 7

texts:
I am building Drupal 7 Custom Module, my module needs to have cron job running on specific time, instead of the default cron time. How do I implement this?

This is my code for cron :

function mymodule_cron() {
    mymodule_data_process();
}


texts: How can I programmatically reindex Commerce products to AWS Elastic Search?

texts:
I am using Drupal 8 Commerce module.
I am using Elastic Search on AWS platform.
From the Admin whenever product is saved, those changes are directly applied on Elastic Search server, but when I try with $product->save() it is not working 100%.
So if I have to update 10 products in Elastic Search how to achieve that programatically?
In particular, I have to update one field only. Because what is happening that, it will update that field value in database but not on Elastic Search.
I found this useful post for Node How To Force Search API To Reindex a Node / an Entity


texts: Approach for building local/city versions of a national website?

texts:
I'm looking for ideas and advices on how to adapt a national website to cities depending on whether the user is logged in or not.

As for a news website, the front page for anon users would be a mashup of nodes from all the regions.
But registered users will set their city during the registration process or later by editing their profile and will then have a local adapted version of the website.

Any ideas on how to achieve this are welcome


texts: I need to copy a value of one field to a decimal filed. When I try to do this with VBO and a token [node:price] I get an error: Only numbers and the decimal separator. Is there a way to copy fields into a decimal data type?


texts:
I'm make an Rest module, when I start config, I found this problem, I dont know what I'm missing.

How to enable authentication ??

**Authentication**
No authentication modules are enabled, all requests will be anonymous.

  I cannot POST data, using GET still working

<result>Access denied for user anonymous</result>


texts: How to access node field content in a custom module?

texts:
I have a content type called districts and i have created the following fields

district geojson(polygon values)
harzards (list) - heavy rain, freezing rain, storm
Alert level (list) - extreme, high, low

I am displaying in a view as a leaflet map.
Now i would like to write a custom module that can get the field content of a nodes ie harzards and alert level and then pass them to a javascript file that will print specific colors to the districts in the view depending on the alert_level.

What is the best way to get the field content (harzards and alert_level) in to the custom module and then pass them to the javascript file?
Or is there another way of achieving this.
Thanks


texts: Custom submit handler stops working when checking route

texts:
I'm trying to setup a custom submit handler, so I can change the redirect URL after submitting comments. Edit: I just want to send users back to the page they were viewing to begin with, but it's a webform with a couple of route parameters, so I need to save them somehow.

This works (the function is called and I see the debug messages):

function mymodule_form_comment_form_alter(&$form, &$form_state) {
    $form['actions']['submit']['#submit'][] = '_submit_foo';
    kint($form['actions']);
}

function _submit_foo(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
    kint('Hello world!');
    \Drupal::logger( 'foo' )->info('hello world');
    exit;
}

This DOESN'T work - i.e. as soon as I add a check on the route:

function mymodule_form_comment_form_alter(&$form, &$form_state) {

    $route_name = \Drupal::routeMatch()->getRouteName();

    if ($route_name == 'entity.webform_submission.canonical') {
        // it's DEFINITELY getting this far!

        kint( 'in conditional' );
        kint( $route_name );
        $form['actions']['submit']['#submit'][] = '_submit_foo';
        kint( $form['actions'] );
    }
}

I know the conditional is being reached, I'm seeing the debug statements.
_submit_foo() isn't called
user is sent to comment.reply instead

Here's a screenshot of the kint($form['actions']):

Context:

these comments are shown inside a view block (format - show: content, single contextual filter, also generated from URL), which is placed, in block layout,  below webform submissions on the standard entity.webform_submission.canonical route - e.g. URL like  /admin/structure/webform/manage/application/submission/123
there's also code in HOOK_comment_view_alter that adds a 'user' cache context to the view (because each user has their comments filtered, so doing it by role is not enough) - in any case, I've tried disabling that and clearing cache
the comments are in a node that has an entity reference to the webform (in case you're wondering how I've managed to combine comments and webform)
comment previews are disabled, and I assume I can rule out that submit action based on the first piece of code working as designed?


texts: Building Social Network with retweet like functionality

texts:
I'm designing a social network that I'd like to build on Drupal 7. I'd like people to have a Twitter-like feed that they can follow people/orgs and see their own posts and "re-tweets".

I'm currently starting to look at Organic groups, I invision the owner(s) of the group posting content to a group and anyone visiting that group page would see the group's "feed"(a view). However, I'm not sure how to implement the "retweet" feature that allows a piece content to be viewed by a retweeter's set of followers.

Any hints would be appreciated.


texts: I'm using jquery countdown timer, I want to but it in the main page content block. How do I put a block inside another block?


texts: Location of data directories under AEgir on Debian

texts:
I've got an out-of-the-box AEgir installation (Apache2, MySQL) running on Debian on a VirtualBox machine. I'd like to move the site data directories off the virtual drive onto my host's drive and use VirtualBox's shared folders to access them.

Which directories do I need to move?

/var/aegir/platforms is already on the host.

/var/lib/mysql holds the sites, so I will move that.

/var/aegir/clients would also need to be moved.

Are there any others?


texts: Adding the category for a custom entity reference field add other fields to the same category

texts:
I have a custom entity reference field working well, but once I added the category to it the other entity reference fields appeared in the same category.

Here is my code:
/**
 * Plugin implementation of the 'region_token' field type.
 *
 * @FieldType(
 *   id = "region_token",
 *   label = @Translation("Region Token"),
 *   description = @Translation("Region custom token."),
 *   category = @Translation("Tokens"),
 *   default_widget = "region_select_widget",
 *   default_formatter = "region_formatter",
 * )
 */
class RegionToken extends EntityReferenceItem {

Any idea about how to fix this?


texts: Taxonomy Terms No Longer Display on Terms Page after editing

texts:
I have encountered a strange issue on a site I am working on that has been active for a few years. (Drupal core 7.54) If I edit or add a new Taxonomy term, then the Taxonomy term will no longer show up on the Taxonomy term overview page (i.e. /admin/structure/taxonomy/[vocabulary]. The term will also not show up as an option to select on a node with a corresponding term reference field.

However, if I make a view and set it to display all terms of a certain vocabulary, all the terms will show up normally. If I use Taxonomy manager module, I can successfully create the terms by adding new terms in bulk, but as soon as I edit their fields, they will disappear. I have searched far and wide, but have not encountered an similar problem and solution. Can anyone help? Thank you.


texts: Redirect After Creating New Taxonomy Term

texts:
I am new to Drupal. I am trying to figure out if it is possible to redirect back to the Taxonomy page right after adding the new vocabulary term instead of being directed to the manage page of the newly created term. Would this have to be changed in the controller for the taxonomy module? Or in another file?

Any help is appreciated, Thank You.


texts: custom hash generated password and module wise added db password is different?

texts:
function custom_submit_method(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  $cusers = $form_state->getValue(array('name'));
  $cpass = $form_state->getValue(array('pass'));

  $gh = new \Drupal\Core\Password\PhpassHashedPassword();
  $hash_password = $gh->hash($cpass);
  $check_pass = $gh->check($cpass, $hash_password);

  //  \Drupal::logger(' customusersubmit')->notice('customusersubmit submit ') ;

 //  login_finalize($cusers, $cpass);

   drupal_set_message($hash_password .'------------'. $check_pass);
 }

Output : $S$5JdG.BjCPSTzc03AJ7aYPwMMH6HR.63IDUzqG3h2kkjG0NEcXtIo------------1 for admin

 Admin Password: $S$EnLPNV41YaHAPKhzwTGHVIir.OlOyK9ngYyEzVKdsd//WMnlaegV

When on comparing to db admin password the hash generated salt value is    different. It timely change for every runtime.

Kindly suggest me the Idea.


texts:
How do I display date ranges for Value1 and Value2 in the following format where value2 is display as the difference between Value1 and Value2 expressed in days. I'd like to rewrite the results of a view field using PHP code.

Value1=1-Jan-2013

Value2=6-Jan-2013

i.e. result expected:

1-Jan-2013 +5d


texts: How do you set a default input text format per content type?

texts:
I want to be able to set a different default input text format per content type and per content field.

For example, the format type choices might be "Plain text" and "Rich text editor" and in some cases I want the format to default to "Rich text editor" but keep "Plain text" as a choice in the dropdown. I know that I can change the order of the text formats to make "Rich text editor" the first choice, but this method changes all of them, that's not what I want to do.


texts: Get user list according to node field value

texts:
I have created one content type named "Project". I have added one field in it named "Skills". Skills is a multiple select field. And I have added one submit button. Which I want to use to get records of users. I have created an Ajax form submit, but my issue now is that I can't alter the form after the Ajax submit.

This is the code I'm currently using:

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

  if ($form_id == 'project_node_form') {

    $form['field_user_lists']['#access'] = FALSE;

    // Provide a submit button.
    $form['submit'] = [
      '#type'   => 'submit',
      '#value'  => 'Get Employee',
      '#weight' => '4',
      '#ajax'   => [
        'callback' => 'MYMODULE_form_ajax_submit',
        'wrapper'  => 'project_node_form',
        'method'   => 'replace',
        'effect'   => 'fade',
      ],
    ];

    $form['actions']['submit']['#submit'][] = '_custom_form_submit';
  }
}

function MYMODULE_form_ajax_submit($form, &$form_state) {

  if (!empty($form_state['input']['field_skills']['und'])) {

    //print_r($form_state['input']['field_skills']['und']); die();
    $query = db_select('field_revision_field_skillss', 'n');

    $query->join('users', 'u', 'n.entity_id = u.uid'); //JOIN node with users
    $query->groupBy('u.uid');//GROUP BY user ID
    $query->fields('u', ['uid', 'name'])//SELECT the fields from node
    ->condition('n.field_skillss_tid', $form_state['input']['field_skills']['und'], 'IN');

    $result = $query->execute();

    $form['field_user_lists']['#access'] = TRUE;

    while ($record = $result->fetchAssoc()) {
      print_r($record['name']);
    }
  }
  else {
    $output = 'Enter a value';
  }
}


texts: Find out which nodes use a specific filter

texts:
How could I find out which nodes actually use a specific filter?

My nodes use an input format that has the Bbcode filter enabled. Now I need to know which (of the several thousand) nodes use BB code, to decide if I still need this filter (in which case I’d switch to Extensible BBCode, and for that I’d like to have a list of nodes to test if everything works correctly).


texts:
I have enable page cache for anonymous users and no cache for block. There are some random data in cache that change on every page refresh.

Once the page cached by cache_page bin block content is not changing, but it working fine with administrator.

How can I fixed this problem with page cache enable.


texts: How to use the flag counter in a twig template of a node?

texts:
The version dev of the module "Flag" for "Drupal 8" has added a new sub module "Flag Count":

https://www.drupal.org/project/flag/issues/2708291

I copied the code

{% set count = '[' ~ flagcount(flag, flaggable) ~ ']' %}

in flag.html.twig and I copy this file into the templates folder of my theme (I did not cache it).

But after I do not know how to do it. Currently to display the flag link in node.html.twig I put the following code :

{{ content.flag_like_node }}

How to add the number of flag ?

I tested the following code and none works

{{ content.flag_like_node_count }}
{{ content.flag_like_node.count }}
{{ count }}


texts: How to Clone a production site locally for testing?

texts:
Ok so I am kinda new to drupal (I've only been working with it for a few months at work) and I just got my first freelance client who has a drupal site that he wants to modify its layout.

I am now stuck at trying to duplicate the website and set it up on my machine and I don't want to do changes to the production environment directly.
Here's what I did so far:

I got access to the webhost server and downloaded the site's drupal root directory
I exported the site's database and stored it on my machine
Used Acquia Dev Desktop 2 to import a local site -> chose the downloaded drupal site root -> selected the sq database dump file that I exported earlier

When I try to open the site on my local server it runs the drupal installation but when I choose a profile and press "Save and continue" it shows me the following message:

  "Drupal already installed. To start over, you must empty your existing
  database. To install to a different database, edit the appropriate
  settings.php file in the sites folder."

Now I know that drupal is already installed probably because I cloned the website codebase and database exactly as they are from the webhost server, and I did not change any of the settings.php files.
How exactly do I run the website l locally through Acquia Dev Desktop and then push my changes to the host?

Any tips, best practices comments, and advice is highly appreciated!


texts:
I am loading a term and trying to get the author or owner of the term, however I can not see any function under the Term Class

On the other hand I can see the translation author being present on the edit page.

Any way to retrieve author for Term?


texts: Date iCal and Organic Groups: Make an iCal feed (subscription) accessible for a private group outside of Drupal?

texts:
I'm making a calendar iCal feed for a private group using Date iCal, Organic Groups and Views. The group events created are private, for that group only, causing a dilemma.

It all works great while I'm logged in and testing the feed via my web browser (where I'm logged in at). When I access the feed in another browser or calendar app, the feed is still valid and "intentionally left blank" due to great Drupal security built in...

How do I get around that? The ideal solution is to enable basic HTTP authentication and login that way via the calendar app. The calendar app offers an option for entering user/pass to access a link via basic authentication.

Otherwise, the site I'm working on won't contain very sensitive info and I'd be happy generating an obscure view path to share internally, and a view that somehow bypasses the OG roles (I know, that's evil!).

Any ideas on how to proceed? I appreciate any feedback in advance! :D


texts: Addressfield autocomplete language independent or restrict user language when storing information

texts:
I've got address field autocomplete for storing user city only but when entering information it stores them language specific e.g. if ones enter

София, България

it's not the same as

Sofia, Bulgaria

Although both stores the same latitude and longitude.
In database they are stored as:

a:4:{s:8:"latitude";s:10:"42.6977082";s:9:"longitude";s:18:"23.321867500000053";s:4:"zoom";s:0:"";s:17:"formatted_address";s:28:"София, България";}

a:4:{s:8:"latitude";s:10:"42.6977082";s:9:"longitude";s:18:"23.321867500000053";s:4:"zoom";s:0:"";s:17:"formatted_address";s:15:"Sofia, Bulgaria";}

As I need a view with exposed filter for filtering users by city this results in showing two kind of results one for those stored in Bulgarian and one for those stored in English.

I need a way to restrict user entered data to be stored only in one language or to unify results based on lat/lon


texts: How to rebuild images using Imagemagick?

texts:
I have switched the Image toolkit from GD2 to Imagemagick. It’s working great for new images, however previously uploaded images still show up with lowres quality.

How can I regenerate ALL images using Imagemagick?

I've followed up: Rebuild images from image style

drush: drush image-flush mystyle
rm -rf sites/default/files/styles
Clearing Caches a couple of times and hit save on all image styles.

However all images still show up with lowres quality. When I manually update a node, the image quality looks correct. Also, the file size changes. Looks like imagemagick isn’t triggered. What can I do?


texts: How to pass arguments to a view from Rules?

texts:
I am trying to use a view which depends on arguments but somehow it seems that the arguments are not passed to the view since I am getting no results. The view works when executed directly.
The rule is triggered by Cron. Does Cron require any special permission to access the view?
Any other ideas on solving this would be much appreciated

Rules is version 7.x-2.10
Views is version 7.x-3.16
Views Bulk Operation is 7.x-3.4+13-dev

{ "rules_send_reminder_1" : {
"LABEL" : "Send Reminder 1",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"TAGS" : [ "Reminder" ],
"REQUIRES" : [ "rules", "views_bulk_operations" ],
"ON" : { "cron" : [] },
"DO" : [
  { "data_calc" : {
      "USING" : { "input_1" : [ "site:current-date" ], "op" : "+", "input_2" : 7776000 },
      "PROVIDE" : { "result" : { "result" : "Calculation result" } }
    }
  },
  { "drupal_message" : { "message" : "Fetching licenses that expire \u003C [result:value] and with status = 1" } },
  { "views_bulk_operations_action_load_list" : {
      "USING" : { "view" : "licence_reminder|default", "args" : "[result:value]\r\n1" },
      "PROVIDE" : { "entity_list" : { "entity_list" : "A list of entities" } }
    }
  },
  { "LOOP" : {
      "USING" : { "list" : [ "entity-list" ] },
      "ITEM" : { "list_item" : "Current list item" },
      "DO" : [
        { "drupal_message" : { "message" : "Processing licence with id : [list-item:license-id]" } },
        { "component_rules_reminder_1" : { "license" : [ "list-item" ], "status" : "1" } }
      ]
    }
  }
]
}
}

Note:  I am hoping to find users that hold an expiring license, and that have been issued a new invoice which remains unpaid with the view (each user holds a status that indicates if the invoice has been issued and if it is paid or not). Then I will send the user a reminder email.


texts: How do I properly add css to my feature?

texts: I have a feature that just contains a few views. How do I properly add a stylesheet to it?


texts: How to add a referenced taxonomy term name to the node title in page-title.html.twig

texts:
Using a term reference field, I am adding the manufacturer's name to the front of our node titles in views for styling and line breaks between the manufacturer field and the title which is really nice. For the node display titles, I am currently using a block view for the manufacturer's name, and placing it above the page title block in the block layout. This stacks the Manufacturers name above the Node title which i don't really prefer:

Manufacturer
Some Node Title

I would like to add the field_manufacturer field to the node display title as a prefix so that it is inline and not stacked like my example above, and I need to add a class to it so that I can target and style it. I am not sure which twig file is responsible for rendering the title, so I would really appreciate help marking this up properly.

Thanks!


texts: Is there a way of completely replacing the SQL of a View with my own custom string?

texts: Recently I completed a rather complicated View, with plenty of relationships, filters, etc. I needed the View for its elegant page system. Is there a way, after seeing the SQL string, that I complete my string in MySQL, and with minimal change, use it in db_query standard format to replace the SQL string of the View? I know about hook_query_alter and hook_view_query_alter but it is too much abstract than a simple SQL-string, mainly if I already have the string almost complete from the Views UI.


texts: Block form: radio buttons selection not saved

texts:
I have a block form with 1 radio button and one text field.
The problem is the selection for the radio button is not saved: in blockSubmit $values['colour_select'] is empty.
The value of the text box is saved and working fine.
What is missing for the radio button?

Thank you

class UnitSiteIdentityBlock extends BlockBase implements BlockPluginInterface{
  public function build() {
    $config = $this->getConfiguration();
    $colour_select = $config['colour_select'];
    $custom_colour = $config['custom_colour'];
    return [
     '#theme' => 'folwell_unit_identity_block',
     '#colour_select' => $colour_select,
     '#custom_colour' => $custom_colour,
    ];
  }
  public function blockForm($form, FormStateInterface $form_state) {
    //$form = parent::blockForm($form, $form_state);
    $config = $this->getConfiguration();
    $form['colour_select'] = [
      '#type' => 'radios',
      '#title' => $this->t('Pick a colour'),
      '#options' => [
        'white' => $this->t('White'),
        'black' => $this->t('Black'),
        'other' => $this->t('Other'),
      ],
      '#attributes' => [
        'name' => 'field_select_colour',
      ],
      '#default_value' => $config['colour_select'],
    ];
    $form['custom_colour'] = [
      '#type' => 'textfield',
      '#size' => '60',
      '#placeholder' => 'Enter favourite colour',
      '#attributes' => [
        'id' => 'custom-colour',
      ],
      '#default_value' => $config['custom_colour'],
    ];
    return $form;
  }
  public function blockSubmit($form, FormStateInterface $form_state) {
    //parent::blockSubmit($form, $form_state);
    $values = $form_state->getValues();
    foreach ($values as $key => $value) {
      \Drupal::messenger()->addMessage($key . ': ' . $value);
    }
    $this->configuration['colour_select'] = $values['colour_select'];
    $this->configuration['custom_colour'] = $values['custom_colour'];
  }
}


texts: Drupal 7 /user url goes to a page that has 2 tabs Login and Request new password which is what I want for all of our users except for one.  How can I NOT show the Request new password tab within the /user (login) page for one particular user ($user->name)?


texts:
How can I "attach" xdebug to drush in a docker container?

By that I mean, how can I have xdebug show me a history of an import script? And to look at the single variables that are defined and occupied during the import script?

The whole thing runs on:
Docker version 2.1.05 (40693), Engine: 19.03.5, running on Mac 10.15.1.
Drupal version 8.7.9.
PhpStorm, Version 2019.3

My Config tempter, here the file docker-compose.yml:

version: "3.4"

services:
  mariadb:
    image: wodby/mariadb:$MARIADB_TAG
    container_name: "${PROJECT_NAME}_mariadb"
    stop_grace_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD
    ports:
      - "4306:3306"
  mysql:
    image: wodby/mariadb:$MARIADB_TAG
    container_name: "${PROJECT_NAME}_mariadb_test"
    stop_grace_period: 30s
    environment:
      MYSQL_ROOT_PASSWORD: $DB_ROOT_PASSWORD
      MYSQL_DATABASE: $DB_NAME
      MYSQL_USER: $DB_USER
      MYSQL_PASSWORD: $DB_PASSWORD

  php:
    image: wodby/drupal-php:$PHP_TAG
    container_name: "${PROJECT_NAME}_php"
    environment:
      PHP_SENDMAIL_PATH: /usr/sbin/sendmail -t -i -S mailhog:1025
      DB_HOST: $DB_HOST
      DB_USER: $DB_USER
      DB_PASSWORD: $DB_PASSWORD
      DB_NAME: $DB_NAME
      DB_DRIVER: $DB_DRIVER
      PHP_FPM_USER: wodby
      PHP_FPM_GROUP: wodby
      COLUMNS: 80 # Set 80 columns for docker exec -it.

### From here the config of the Xdebug:
  PHP_XDEBUG: 1
      PHP_XDEBUG_DEFAULT_ENABLE: 1
      PHP_XDEBUG_REMOTE_AUTOSTART: 1
      PHP_XDEBUG_REMOTE_HOST: host.docker.internal # Docker 18.03+ Mac/Win
      PHP_IDE_CONFIG: serverName=Docker
      PHP_XDEBUG_REMOTE_CONNECT_BACK: 1
    volumes:
      - ./:/var/www/html

 nginx:
  image: wodby/nginx:$NGINX_TAG
  container_name: "${PROJECT_NAME}_nginx"
  depends_on:
    - php
  environment:
    NGINX_STATIC_OPEN_FILE_CACHE: "off"
    NGINX_ERROR_LOG_LEVEL: debug
    NGINX_BACKEND_HOST: php
    NGINX_SERVER_ROOT: /var/www/html/docroot
    NGINX_VHOST_PRESET: $NGINX_VHOST_PRESET
  volumes:
    - ./:/var/www/html
  labels:
    - 'traefik.backend=${PROJECT_NAME}_nginx'
    - 'traefik.port=80'
    - 'traefik.frontend.rule=Host:${PROJECT_BASE_URL}'

 selenium-firefox:
  container_name: "${PROJECT_NAME}_firefox"
  image: selenium/standalone-firefox-debug:2.53.1
  volumes:
    # - /dev/shm:/dev/shm
    - ./:/var/www/html
  ports:
    - "5905:5900"
    - "4444:4444"

 mailhog:
  image: mailhog/mailhog
  container_name: "${PROJECT_NAME}_mailhog"
  labels:
    - 'traefik.backend=${PROJECT_NAME}_mailhog'
    - 'traefik.port=8025'
    - 'traefik.frontend.rule=Host:mailhog.${PROJECT_BASE_URL}'

memcached:
  container_name: "${PROJECT_NAME}_memcached"
  image: wodby/memcached:$MEMCACHED_TAG
  command: "sh -c 'memcached -m 1024'"

portainer:
  image: portainer/portainer
  container_name: "${PROJECT_NAME}_portainer"
  command: --no-auth -H unix:///var/run/docker.sock
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
  labels:
    - 'traefik.backend=${PROJECT_NAME}_portainer'
    - 'traefik.port=9000'
    - 'traefik.frontend.rule=Host:portainer.${PROJECT_BASE_URL}'

traefik:
  image: traefik:v1.7-alpine
  container_name: "${PROJECT_NAME}_traefik"
  command: -c /dev/null --web --docker --logLevel=INFO
  ports:
    - '80:80'
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock

 php_test:
  container_name: "${PROJECT_NAME}_php_test"
  image: registry.my_projekt.de/drupal-test
  volumes:
    - ./:/var/www/html
  environment:
    CI_PROJECT_DIR : "/var/www/html/"
    DATABASE_PATH: "/root/database.sql"
    SELENIUM_PORT: "4444"
    BROWSER: "firefox"
    WEB_DRIVE: ""
    DISPLAY: ":99"
    UPDATE_ALIAS: "myProjekt:update"
    DB_HOST: 'mysql'
  labels:
    - 'traefik.port=80'
    - 'traefik.frontend.rule=Host:test.${PROJECT_BASE_URL}'

 php_quality:
  image: hussainweb/drupal-code-quality:latest
  command: tail -f /dev/null
  volumes:
    - ./:/var/www/html


texts: What happens to Webform data when a component is deleted? Can I change a component type?

texts:
I inherited a complicated Webform with several hundred submissions. One of the components was a Textfield used to capture the email address of the form submitter. For some reason this is a Textfield and not an E-mail field which prevents me from using the E-mail address to send a confirmation email.

If I were to delete the textfield email component what would happen to all the data? I'm assuming it would be erased.

Is there any way to change the type of a form component while still preserving the data?

Update: I am using Drupal 7 and Webform 3.19


texts: Change Exposed Filter from Dropdown to List

texts: How can one change an exposed filter format so it is displayed as a list rather than a dropdown list? If it is relevant, I am using the Better Exposed Filters module.


texts: Cloning a Drupal website without content

texts:
Drupal 8 ships with the new Configuration Management System. This system checks the sites UUID and only allows imports of configuration if the uuid is the same.

This means, your steps to create a new environment is:

dump db from existing environment
import db to new environment
import config in new environment

This however does not work in cases where one is not allowed to access Production data. How would one in this case then handle the creation of new environments?

Same goes for a new developer entering the project, he has to import a DB from prob/stg. But what if this db multiple GB's big. You are now running a multi GB website on your local machine.

In symfony we "solve" this with fixtures to create dummy data. this can then be used to create new environments from scratch on the fly. In Drupal 7 this was also possible with features.

So my question is, how does one do this in Drupal 8 if cloning the existing environment is forbidden? How do you sync configuration between these environments?


texts: How do I prevent the automatic removal of a database table when a module is uninstalled?

texts:
In Drupal 7, a database table created through hook_schema() gets created on module installation, and gets deleted on uninstallation.

I would like to prevent the removal of a database table when the module defining it is uninstalled, because the data which I am storing is very important so I want to make sure that even if someone even uninstalls the module for certain purpose than also data retains. Backing up the table before is certainly one solution but I am looking for some better alternative.


texts: Is there a module for creating images and labelling and placing them in a document?

texts:
I am looking for a module which allows me to place images with additional information to the text of a page using a filter connected to the image's node id.

I need a content type with something with fields like this:

The image itself
A description
Additional fields with some information about the image, like source, size, attribution, date, license, etc

What I need is something like a filter that allows me to embed the image in a document displayed with some of the additional fields in a properly formatted manner.

Is there a module for doing this?


texts: Migrate into Multi-value Checkbox from CSV

texts:
Update: Turns out typos suck. But added an answer to this as well, in case anyone ever stumbles upon this...

I'm running into a bit of an issue using Migrate API. I thought I had a fairly simple use-case, but am unable to actually find an example for this particular instance.

I have a CSV I'm importing, utilizing the migrate_source_csv module. My migration was working just fine, but now I need to add a field_dealer_type field. This field is a multivalue checkbox. In the CSV, it's represented in a single dealer_type column, separated by commas (I've also tried other delimiters with no success).

A couple example rows of my CSV would look like:

id,name,city,dealer_type
1,Sample Location,Cool City,"trucks,motorcycles"
2,Another Location,Second City,trucks

The CSV is well-formatted, wrapping the dealer_type column in quotes when necessary.

However, I'm not able to get these to import properly into my nodes. I've verified the values through the CSV are valid options in the field definition as well (trucks, motorcycles).

I've started with the explode plugin, as other examples use that as well, but I know I'm missing a follow-up processing. I've seen example using Taxonomy and entity_generate, but that doesn't fit my use-case. I also have the migrate_plus module installed, for clarity.

langcode: en
status: true
dependencies: {  }
id: dealers_csv
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags: null
migration_group: default
label: 'Import Dealers'
source:
  plugin: csv
  path: sites/default/files/dealer_locations.csv
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - id
  column_names:
    -
      id: 'Unique Id'
    -
      name: 'Dealer Name'
    -
      city: City
    -
      dealer_type: 'Dealer Type'
process:
  title: name
  type:
    plugin: default_value
    default_value: dealer_location
  field_dealer_name: name
  field_dealer_city: city
  field_dealer_type:
    plugin: explode
    limit: 2
    delimeter: ','
    source: dealer_type
destination:
  plugin: 'entity:node'


texts: Set Custom "Paragraph Type Icon" For Paragraph Type With Module During Install

texts:
Drupal 8.x

I have a paragraph that is installed via a custom module, this is done with .yml files in the MYMODULE/config/install/ directory. I would like to have a custom icon added to the "Paragraph type icon" field for the Paragraph type during install.

Example config export after manually uploading an image after the paragraph type is installed:

langcode: en
status: true
dependencies:
  content:
    - 'file:file:328b219f-01e9-4dfd-8fdd-c304fcf6e368'
id: paragraph_name
label: 'Paragraph Name'
icon_uuid: 328b219f-01e9-4dfd-8fdd-c304fcf6e368
description: ''
behavior_plugins: {  }

The icon value is set/exported as a uuid, I am wondering how I can set this field value during install using an icon that resides in my module folder?

I have functioning config files and .module file.


texts: How to create a component which has specific content on each page

texts:
I'm a novice at drupal, so I'm still figuring things out. I'm looking for a way to accomplish the following the 'drupal way'.

I want to create a component, or a block, or something that allows the end user to enter a url to a page, a description, a title and an image. This component would be visible on the page as a clickable item.

I've tried using a custom content type, and used the views module to create a block out of these. This works, but it displays the same items as a block on each page. I need a way to make them different on each page. I'm not sure blocks is the way to go.


texts:
i've several list of products display on a Drupal block. I get the list of products using views module. Then, i've several pages dedicated for each product. Before the list of products display on a block, i need to check if the page for the product exist of not. if exist, i need to display the product as list, but if not exist, i don't want to display it as link.

Example:

I have pages:

Product/A for product A

Product/C for product C

I have products:

A

B

C

D

So, views result that display on the block, should be:

A -> as link

B -> not a link

C -> as link

D -> not a link

How can I achieve that?


texts: Why am i getting a blank UI in filedepot module in drupal 7?

texts:
I want to have proper file management for my site powered by drupal. I have downloaded the filedepot module, and have performed all the steps to configure it properly...but still i am not getting the user interface after i click the filedepot link on the navigation menu, its totally blank. i figured out there are many, who are getting the same problem; have tried different solutions, but no luck anywhere.

please suggest me some solution for the same, m using drupal 7, filedepot 7.x-1.1 and libraries 7.x.-1.0.

please please need help badly


texts: Can I add a field collection to a block?

texts:
I have made a field collection, exported as a Feature and now I'd like to add it to a block.  Does anyone have any suggestions?  I have added fields to blocks through the form API, but that doesn't seem to apply here.

I would like to add this field collection through code, rather then finding a module.

I've looked at hook_block_configure to add the form there, but I don't know if I can add a type that isn't listed in Form API reference.


texts:
I have recently installed drupal6 and filedepot. Things were working ok, but I was getting some errors come through so I patched it with this http://drupal.org/files/issues/filedepot-group-by.patch

But now I am getting these errors

warning: pg_query(): Query failed: ERROR: syntax error at or near "REGEXP" LINE 1: ...FROM nextag_items WHERE type='filedepot' AND tags REGEXP '(^... ^ in /usr/share/drupal6/includes/database.pgsql.inc on line 139.
user warning: query: SELECT itemid FROM nextag_items WHERE type='filedepot' AND tags REGEXP '(^|,)1(,|$)' in /etc/drupal/6/sites/default/modules/filedepot/nexcloud.class.php on line 504.

Any one know any thing about them. Or know of a better document managment system for drupal 6?


texts: EntityFieldQuery - Order by the number of entity reference field values, matching a given array

texts:
I have a list of nodes (group), each referencing a number of other nodes (event) using an Entity Reference.

I can query the  the "group" using $query->fieldCondition('field_group', 'tid', $group_tid);.

However, I want to then "weight" the results based on the A: if they have a matching section. B: how many events match.

So, if I want all groups with the events foo and bar, and the data was

Group 1
   foo
Group 2
    foo
    bar
Group 3
 {no sections}

Then the results would be:

Group 2
Group 1
Group 3

Hopefully that makes some sense. Thanks for any help / advice!


texts: How to perform a redirect based on the value entered in a Webform component?

texts:
How to perform a redirect after a Webform submission, i.e. to different pages for different answers?

The scenario is like so:

If user enters "foo" for some Webform component, then page must be redirected to /foo.
If user enters "anything else but foo", then page must be redirected to /bar.


texts: How to set the default format in text_format and hide the select?

texts:
/**
 * Implements hook_form_alter().
 */
function MODULE_NAME_form_alter(
  &$form,
  \Drupal\Core\Form\FormStateInterface $form_state,
  $form_id
) {

  if ($form_id == 'node_article_form') {
    $form["body"]["widget"][0]['#allowed_formats'] = ['full_html']; // Your default format
    $form["body"]["widget"][0]['#after_build'][] = 'MODULE_NAME_hide_format';
  }
}

function MODULE_NAME_hide_format(
  &$element,
  FormStateInterface $form_state
) {
  if (isset($element["format"]["format"])) {
    $element["format"]["format"]["#access"] = FALSE;
  }

  return $element;
}


texts: is $node always available in page.tpl.php

texts: I'm periodically getting an error about $node being undefined in one of my template files.I have a simple if condition that checks the node type being displayed. I assumed $node is always available, or am I wrong?


texts: Tagging people on blog entries and being able to access their profiles from tags

texts:
I'm trying to create a blog posts where users are able to create challenges and tag other users. I succeeded in creating blog entries, I succeeded in adding tags on blog posts.

But I struggle with making so that clicking on tag would bring me to the user profile. I tried creating taxonomy called users and I specified url alias: /user/* Saddly if I clicked on tagged person, Im being brought to ..../taxonomy/term/4

How can I solve this?


texts:
I have been trying to create a template to control the user login block given in Drupal 7.  I've referred to the template suggestions documentation page and have tried block--user-login.tpl.php, block--user.tpl.php and am getting no love.
What is the template name for the user login block?.


texts:
I am trying to access from views-view-field--title.tpl template to another field...

I have this code:

<?php print $output;
  print $row->{$view->field['field_NAME']->field_alias};
 ?>

But it shows me just a number.. (1,2,3,4,5,....)

Can someone help me?

Thank you!


texts:
EDIT: Looks like I accidentally changed number of values for this field to 1 - it should be Unlimited. It's working now, thanks everyone.

I don't know what I did but I noticed that all (except the first one) body field data in all the nodes disappeared - they're not even available in editor.

All the data is still in DB (in field_data_body table) but it's not showing on website.

I have no idea how to fix this, has anyone had the same problem?


texts: Content listing to show custom fields of associated terms instead of title

texts:
I'm using Drupal 7 with views 3.

I have a Content Type of "Flag" associated with a vocabulary named "Colors", and its terms are Red, Blue, White, Yellow, etc. Each color has a custom field named field_color_image where I upload a small color thumbnail.

Currently I have a following 'Content' view set up, that lists flag names and it's colors(terms).

In my Views, the Fields is set to display 'Content: title' and 'Content: field_color'

The output looks like this:

- American Flag
Terms : Red, Blue, White

- Russia Flag
Terms : Red, Blue, White

- Sweden Flag
Terms : Blue, Yellow

How can I output the field_color_image of the term instead of the title?

Notes: I have checked under replacement patterns and they don't have custom taxonomy field support.

Thanks.


texts: how to make my blog archive links work in panels?

texts:
I am a newbie with drupal 7. Currently I migrate blog from a drupal 7 site without panel and PE  to another drupal 7 site with Panel and PE, but somehow the archive view on the right side of the panel could not direct the archived content to a panel. I mean, when I click on the archive links, it direct to a archived content but not on a panel. How should I put the archive links view and linked archive content in a panel so that all the pages look the same? I want the linked archived content page to be a panel with right side archive view links still there.

Any help and advice is highly appreciated.

Thanks


texts: Multiple select do not save for my custom field with custom widget

texts:
I'm trying to save multiple values from multi select option form which I created in the custom widget with:

$element['labs'] = array(
  '#type' => 'select',
  '#options' => $list,
  '#multiple' => 'multiple',
  '#title' => t('Labs'),
);

The biggest problem is the values won't save! As I know the delta should increment automatically if cardinality is set to more than 1.

1) I can't change cardinality or some other setting after activating the field in the edit field form

2) I can't see my custom field in the field type list to select from if I try to alter existing widgets:

'default_widget' => 'options_select',
'default_formatter' => 'status_field_options',

How could I extend standard list field type to populate the multiselect with my own generated data?

OR

How could I write my widget that Drupal let me save multiple values with different delta?


texts: Page variant with selection rules: localhost

texts:
after finishing a new theme, the dev and live servers are working great, but when I moved it all to my local desktop, the custom-pages are not showing up.

I have selection rules based on the url as we have about 6 sites of which the proper variant is served up according to the domain.

So, locally, nothing is showing. I'm guessing it's because of the selection rules. I can't add "localhost:8888" as a domain in the Domain Module we are using..it won't let me... so is there a way to override those rules when logged in as admin or some other one-shot way w/o removing all those selection rules per-page?


texts: Unable to upload file from $_FILES array in drupal7

texts:
I am trying to upload file from $_FILES array. but getting following error in drupal7.

The specified file temporary://fileOYnPHK could not be copied, because the destination directory is not properly configured.
This may be caused by a problem with file or directory permissions. More information is available in the system log.

The sites/default/files has permissions 777

Here is my code

if($_FILES['files']['name']['field_tenant_review_ref_und_form_field_tenancy_document_und_0']){
    $file_path = file_save_data(file_get_contents($_FILES['files']['tmp_name']['field_tenant_review_ref_und_form_field_tenancy_document_und_0']),
    'public://sites/default/files/'.$_FILES['files']['name']['field_tenant_review_ref_und_form_field_tenancy_document_und_0']);
   }
   //$tenant_review->field_tenancy_document->file->set($file_path);

Is there any mistake in code? Please suggest.


texts: When managing fields for a content type, fields of type "list (integer)" can't be shared?

texts:
In the drop-down for "add existing field" not all fields are available for reuse. Specifically I would like to reuse a field of type "list (integer)" because I will be adding 300 of them to my content type with exactly the same settings (just different labels and machine names). Doing  the manually is going to take me over eight hours since it takes about 1.5 min to add a field and configure it's settings. Is it possible to reuse fields of type "list (integer)"?

Thanks!!

ps: if you are unsure what I mean by reusing a field see here: Documentation for Field-UI and look at the section titled, "Reusing Fields".


texts: How to programmatically create a dropdown of users of role x

texts:
I have a question for you guys: how can I programmatically create a dropdown of users of role x to use as a filter on a view? I'm am pretty new to Drupal, but I think this requires a db_query.

I've experimented with a field called 'hosting provider', but this doesn't work. Here is the code:

<?php

function dd_hosting_provider_form_views_exposed_form_alter($form, &$form_state) {
  $field_id = 'field_hosting_provider';
  // Only alter forms with the necessary field
  //if (isset($form[$field_id .'_value'])) {
    // Build a query to get all node ids having the specified field
    $query = new EntityFieldQuery();
    $query = db_select('users', 'u')
                ->fields('u', array('uid', 'name',))
                ->condition('ur.rid', array(8),'IN') // 8 is the rid for Developer.
                ->groupBy('u.uid');
    $query->innerJoin('users_roles', 'ur', 'u.uid = ur.uid');
    $results = $query->execute();
    var_dump($results);exit();

    // Attach the field values to the nodes
    $nodes = $results['node'];
    field_attach_load('node', $nodes, FIELD_LOAD_CURRENT, array('field_id' => $field_id));

    // Add a default so the filter is optional
    $options = array('' => ' - Any - ');

    // Buld the options array based on the query results, overwriting duplicate entries
    foreach($nodes as $nid => $node) {
      $value = $node->field_primary_dev['und'][0]['target_id'];
      $options[$value] = $value;
   //}

    // Alter the field
    $form[$field_id .'_value']['#type'] = 'select';
    $form[$field_id .'_value']['#options'] = $options;
    $form[$field_id .'_value']['#size'] = 1;
  }
}

Any ideas?


texts:
I have site (e-shop) that uses Search API. Just Search API, Search Autocomplete, Display Suite Search and Database Search are enabled. It was not configured by me.

However, we have big problem. Search returns strange results, we cannot use search by brand cause when we choose brand on Exposed Filter with AJAX and catalog reloads, add to cart product's forms wont work cause forms were rebuild and there's no workaround for this issue.

Can you tell best (and modules) way to organize search in Commerce shop?

Do I need to use Facets and Apache Solr - technologies, which are not used now?


texts:
I want to insert XML editor for text area. Is it possible?

Currently Is there any XML data editors. If there is no XML editor for text area what is the possible way .


texts: When using Entity Translation and the Title module, how can I get the translated term from the term ID programmatically?

texts:
I have a term ID and I want to programmatically get the translated term name (via Entity Translation and the Title module) for the logged-in user's language.  How can I do this?

This similar question asks about how to get the translated name programmatically when using i18n taxonomy translation (the other major approach besides Entity Translation).


texts:
I have my Openscholar server inside my network with an internal IP and on my firewall I assigned an external IP to redirect traffic to the internal IP. I can access the index page from outside using the outside IP address but when I go to a user's page (/?q=someusername) it redirects into my internal IP address.

Here is an example:
Main Page: http://65.79.20.22

if you click on one of the user websites it redirects into http://10.1.0.22 and of course its not available from outside.

Any ideas? Thanks advance!


texts: Migrate: What's the difference between prepare() and prepareRow()?

texts:
Using the Migrate module: I understand that prepareRow() runs a filter on the row and should return TRUE or FALSE based on some conditions, which allows a row to be migrated or not, but could someone clarify:

when to use prepare()
when to use prepareRow()
why you wouldn't add a filter in the initial sql query to filter row results that you might remove/include in either of the above

Thanks!


texts: Commerce- Show a base price (MSRP) and a discount (the real price)

texts:
I have a number of products for which I would like to display the MSRP (with a line through it) and then the discount price (my store's actual price).

I do not want to actually discount the products; the "discounted" price is the real price in the system.  Rather, I want to also show the MSRP (to show what a good deal my customers are getting).  This is similar to what Amazon.com does (they always have the original price with a line through it, and next to that is the Amazon.com price).

What is a sane way to do this?  Should I add another field of type price to products?  Should I add that field instead to my product display content type?  From the perspective of long-term maintenance, I'm not sure how to approach this.

Here's an example from Amazon:


texts: How to send email when customer cancel payment?

texts:
I am using Drupal Commerce 7x-1.10 and PayPal WPS 7.x-2.3 module. How can I send an email to customer (both anonymous and authenticate), if they cancel the order or cancel the payment method or cancel anytime within the checkout process?

I am using rules, also I have use "cancelled" in the Condition section. But for some reason it is not working. Please see below for the rules code -

{ "rules_completing_the_checkout" : {
    "LABEL" : "Completing the checkout",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "mimemail", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "IF" : [
      { "data_is" : { "data" : [ "commerce-order:status" ], "value" : "canceled" } }
    ],
    "DO" : [
      { "mimemail" : {
          "key" : [ "commerce-order:mail" ],
          "to" : [ "commerce-order:mail" ],
          "cc" : [ "" ],
          "subject" : "Cancel Order? Why",
          "body" : "Cancel Order? Why",
          "plaintext" : "Cancel Order? Why",
          "language" : [ "commerce-order:state" ]
        }
      }
    ]
  }
}


texts: how to change the weight of the node to be the last one

texts:
i created aview that list all photos orderd by weight to be draggable , when i add  new anode it take arandom weight but i want it to be the last one .
i thought to set static weight using hook_insert but without any results

function Misc_node_insert($node) {
  if ($node->type == "photo_gallery_images") {

    $nid_curr = $node->nid;
    print_r($nid_curr);

    $nid = db_insert('weight_weights') // Table name no longer needs {}
    ->fields(array(
      'entity_id' => $nid_curr,
      'entity_type' => 'node',
      'weight' => 20,
    ))
    ->execute();

  }
}


texts: Changing the $from email in D6 contact_mail_user_submit()

texts:
// Send the e-mail in the requested user language.
  drupal_mail('contact', 'user_mail', $to, user_preferred_language($account), $values, $**from**);

I wish to change the $from email to "do-not-reply@domain.com" to accommodate our email configuration.

$from is defined as $user->mail [here in the function][1] and I can't figure out how to override this via MODULE_form_contact_mail_user_alter.


texts: How to specify AND, OR with dynamic query

texts:
I’m trying to create a dynamic query, the query logic conditions needed are: AND, and OR.

The main query will include two sub queries.

The ConditionInterface::condition documentation states that:

  If called with 1 parameter, it should be a ConditionInterface that in
  itself forms a valid where clause. Use e.g. to build clauses with
  nested AND's and OR's.

I cannot find the example to build clauses with nested AND’s and OR’s so I’ve done some digging through the ConditionInterface API Reference (https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%21Query%21ConditionInterface.php/interface/ConditionInterface/8.6.x)

I found a function conditionGroupFactory (https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%21Query%21ConditionInterface.php/function/ConditionInterface%3A%3AconditionGroupFactory/8.6.x)

The conditionGroupFactory function appears to be what I need, however I cannot find any implementation examples.

Could someone please explain the implementation of this function.

$result = $connection->select('inventory', 'inv');
$result->fields('inv', ['part_number']);
$result->condition('inv.visable', 1);
$result->conditionGroupFactory('AND')->condition('inv.part_number', $queryOne, 'IN');
$result->conditionGroupFactory('OR')->condition('inv.part_number', $queryTwo, 'IN');

Note: $queryOne, $queryTwo; Are of type SelectInterface.

My Objective SQL Statement:

SELECT inv.part_number
 FROM inventory AS inv
 WHERE inv.visable = 1
 AND (inv.part_number IN (SUBQUERY_1)
 OR  inv.part_number IN (SUBQUERY_2));


texts:
I'm very much new to Drupal. I need to bring a functionality such that user gives some input, say feedback in some pages which will be stored into a custom table (made by me) in drupal database. So I created a custom module that'll will save the inputs into database (through form POST).

Now the problem is, I need to show all these inputs to authorized user. There should be menu link in Drupal menu after logging in and clicking on it should take to a page where I should list all these inputs.

If I bring another module, and set a url, while navigating to that url, what I see is a blank page and there I can show anything. It's fine but I need to show Drupal menu and Drupal like interface. How can I achieve it?


texts: CiviCRM Email Record appearing in other members profile Information

texts:
We have a Drupal module that allows users to sign up and create their own personal fundraising page. Every Drupal user is matched to their equivalent CiviCRM profile where the information is stored. The Drupal module then reads information from CiviCRM  to display custom reports such as how much they have raised and their contact info.

There is one email that is in the system and is getting overlaid somehow into other members profiles. The owner of the email has not created a page, I'm not sure how their email even got into the system. It has happened twice already. On a mailing the owner of the email account responded saying they were not the correct person.

Any ideas how this happened and how to correct it?


texts: Using custom author name in a node instead of author field

texts:
I have a display name field I created for my users (available in account settings). I'd like to display the display name in the node if the person authored that node. I see I have an author field I can use... but that displays the login of the user, while I want to display their pretty display name that I setup instead. Is there a way to include this field instead of the author field?

In views it's easy to do, but I'm trying to use the field in a node.


texts: Should I change multiple text fields values via MySQL or is there any other preferable way?

texts:
The site has a content type and this content type has two fields:

Text Field
Term Reference Field

There are thousands of nodes on this content type and I want to change some values (find/replace).

For example, I want to change all the "ABCD" strings with the "WXYZ" strings on the text fields in all the nodes.

Is it a good way to do this change via MySQL or is there any other preferable way? (Both text field change and taxonomy term replacement).

Note: I saw the Search and Replace Scanner module but it gives some errors I couldn't understand why. And it gives timeout error for a large amount of nodes.


texts:
so, I was trying to get rid of the comment title and there is a lot to read about that on the net, but I still had my issues getting it right, so I came up with this, but I believe there should be a better way.
What is the best way of doing this:

function theme_preprocess_comment(&$vars) {
// Remove the comment title
  $vars['title'] = NULL;
}


texts: How do I redirect to a certain page from user profile page

texts:
I have created a hook and redirected the users after login from the login page to a certain page.

But when I go to /user/login after a successful login will redirect me to the user profile page (/user/1). How do I redirect a logged in user when trying to access /user/login page to a certain page that I have previously created.


texts: How can I disable default blocks in Drupal 7 without touching the Blocks Config admin?

texts:
I'm trying to disable the search form, navigation, and user login blocks from being enabled by default. My main goal is to not touch the admin at all because I want to version control this.

Is there a way to disable the blocks with some sort of hook? I'm newb when it comes to php and coding for Drupal so please be kind.


texts: Saving the content from a Textarea dont works

texts:
An Textfield within my Custom Content Pane works fine.

An Textarea incl. input-filter ('#type' => 'text_format',) will not be saved.

<?php
  function text_edit_form($form, &$form_state) {
      $conf = $form_state['conf'];

      $form['form_text'] = array(
        '#type' => 'text_format',
        '#title' => t('Text'),
        '#format' => 'filtered_html',
        '#size' => 50,
        '#resizeable' => TRUE,
        '#default_value' => !empty($conf['form_text']) ? $conf['form_text'] : '',
      );

      return $form;
    }
  function text_edit_form_submit($form, &$form_state) {
    foreach (array('form_text') as $key) {
      $form_state['conf'][$key] = $form_state['values'][$key];
    }
  }
?>

At drupal.com somebody wrotes, that #default_value expect and string, but text_format is an array. So he postet the following solution.

But how can I build that within my hook_edit_form?

<?php
      // Retrieve the default values for 'value' and 'format', if not readily
      // available through other means:
      $defaults = array(
        'value' => '',
        'format' => filter_default_format(),
      );
      $my_richtext_field = variable_get('my_richtext_field', $defaults);
      // Just construct a regular #type 'text_format' form element:
      $form['my_richtext_field'] = array(
        '#type' => 'text_format',
        '#title' => t('My richtext field'),
        '#default_value' => $my_richtext_field['value'],
        '#format' => $my_richtext_field['format'],
      );
 ?>

Who can help me with that?


texts: Embed block into a custom views template

texts:
I created a custom views template that I have called views-view--page.tpl.php. Now I would like to add a block into the template file.

In my page template file I was able to render a region and do this:

<?php print render($page['leftsidebar']); ?>

But it seems like this will not work for a views template. I am not the best with PHP so any help would be great!

I'm using Drupal 7.


texts:
Can't seem to achieve such setting, just like the one shown at:
http://www.jacklmoore.com/colorbox/example1/
"Group Photo One" link under "No Transition + fixed width and height (75% of screen size)"

How to achieve that in D7 using Colorbox on my Views list of images? Tried all options, all dynamic and it's impossible to browse because navigation arrows are jumping all over because of the different image styles.


texts: I get an AJAX error when I install Drupal 7: Why?

texts:
I tried to install Drupal 7.10, and when the installation has done 28/29 modules, an error occured:

  An AJAX HTTP error occurred.
  HTTP Result Code: 200
  Debugging information follows.
  Path: http://localhost/drupal/install.php?profile=standard&locale=en&id=1&op=do
  StatusText: OK
  ResponseText: ( ! )
  Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\drupal\includes\database\mysql\database.inc on line 153
  Call Stack:

Time Memory Function Location
10.0004371192     {main}()                             ..\install.php:0
20.0043834504     install_drupal()                     ..\install.php:26
30.95958976424    install_run_tasks()                  ..\install.core.inc:79
41.929419997120   install_run_task()                   ..\install.core.inc:342
51.930720117440   _batch_page()                        ..\install.core.inc:452
61.931520124560   _batch_do()                          ..\batch.inc:80
71.931520124560   _batch_process()                     ..\batch.inc:161
81.933320214776   call_user_func_array()               ..\batch.inc:284
91.933320214800   _install_module_batch()              ..\batch.inc:284
101.933320215000  module_enable()                      ..\install.core.inc:1538
112.990422114008  module_invoke()                      ..\module.inc:448
122.990422114224  call_user_func_array()               ..\module.inc:794
132.990422114360  standard_install()                   ..\module.inc:794
1420.519725138960 user_role_grant_permissions()        ..\standard.install:400
1529.936125151208 MergeQuery->execute()                ..\user.module:3030
1629.938825159880 DatabaseTransaction->__destruct()    ..\user.module:3030
1729.938825159880 DatabaseConnection->popTransaction() ..\database.inc:1872
1829.938825159912 DatabaseConnection_mysql->popCommittableTransactions() ..\database.inc:1105

Can anyone help me to fix it?


texts: How to create a Size field on Commerce product content fields?

texts:
I am new to Drupal Commerce and I have set up a store. But the problem is that adding variations for each product is a pain, especially when the product has more than 5 colors and 4 sizes.

What I want to do is to have a size Field in Content type instead of product type's fields so that I add the sizes only once (like choosing the categories or collection).

And then customers can select a radio button or so to be able to add the item to the Shopping Cart.

How can I make it work or is there another solution for it?


texts: Drupal site Phonegap application field collection

texts:
I'm in the process of making a Phonegap application to create nodes of a certain content type. The site I'm writing data to/getting data from utilises Field Collection module, and I've looked at the database structure. It creates additional tables for the contained fields and cross-references them. I was wondering if anyone has come across this situation and how did you manage to solve it.

Note:

I'm using Drupal Services for endpoint,  and my request needs to send all those fields in my fiddle altogether (more than one row).

As for what the fiddle does, I'm creating a table then add more rows to the table.


texts: Search API View exclude nodes with same Value(duplicates)

texts:
I am trying to create a view with the search API(indexed node view).

My English is not so good so I have to describe the structure and what I want as result:

The node has 2 important fields for this question. lets call them field a and field b.

Based on nodes with this fieldvalues:

a: example1 b: 22
a: example1 b: 13
a: example1 b: 27
a: example2 b: 26
a: example2 b: 18
a: example2 b: 4
a: example3 b: 89
a: example3 b: 16
a: example3 b: 29

I want the result of the view like this:

a: example1 b: 13
a: example2 b: 4
a: example3 b: 16

How can I can tell the view to show only 1 node per value A with the lowest value b?


texts: Does unset($form['field']); in hook_form_alter stop entity reference views select list queries from running?

texts:
I have a slow load time in a node form and I suspect the reason is that I am populating entity reference select lists using views & therefore a number of queries are being run to populate those select lists when the form is loaded.

As most of the entity reference fields don't need to be on the node-add form but only the node-edit form I tried using unset($form['field']) and hook_form_alter to remove those fields from the $form array but there is still a slow load time.

Could it be that the fields that get unset in hook_form_alter are still running their views queries?

Thanks very much and have a great day!


texts: What's the proper way of working locally with freshly created features?

texts:
I have recently started to using Features, it was due time.

Once thing I started to wonder, is, once you created your feature locally, what's the best way to work with it. I first thought that creating the feature was enough and once it was there you could use it as such, but disabling the newly created feature doesn't remove everything the features exports, so it doesn't behave the same way as if you installed the same feature on a plain site.

Is that on purpose? If so why? What are the details I should consider for working with Features on the initial site.


texts: Including custom functionality with multilingual capabilities from the start

texts:
Imagine you have a global Drupal site with several languages. One market wants to add custom  functionality for just the English language. From a technical standpoint would it be better to develop the custom functionality with multilingual capabilities by default?

I understand this is a high-level question, but was wondering on the pros and cons. The custom functionality would fit well with other languages, so two specific questions are for instance:

Is the consideration of multilingual often more expensive than developing the monolingual version?
On the long-term is it better to have the multilingual version from the start instead of adding it in a later phase? (updating code after functionality was pushed live).


texts: I broke a view and i'm not sure how to fix it

texts:
I broke a view by adding the "flagged" relationship to the view, then filtering by the flag_id, then deciding against it and removing the relationship. The filter for flag_id was not removed when the relationship was removed so now I get an error on that view -- "The website encountered an unexpected error. Please try again later.".

The actual logged error is

  Uncaught PHP Exception Exception: "No entity type for field flag_id on
  view frontpage" at
  ".../core/modules/views/src/Plugin/views/HandlerBase.php line 712"

I intended on going into the database to fix this but I feel like that's the nuclear option.


texts: Is there a way to create a sort option for search results that works together with facets?

texts:
I'm using Drupal Commerce along with Search API and Facet API to create a search for my product dispays. Is there a way to create a facet that sorts products by price? I've tried using the exposed sort in views, but it doesn't work in unison with the facets. Any ideas? I'd prefer that the sort looks similar to the exposed sort criteria in views.

I'm using views to override a search provided by Search API. The view type is "Product display". I've added a "Search: Fulltext search" contextual filter to the view to override the search form. I'm also using Facet API to provide a faceted search to users made available using blocks on the search page. I've tried using the "SORT CRITERIA", which are available in views, to provide an option of sorting the search results by price and relevance. The problem I'm having with this is that the facets, which are provided by Facet API, don't work together with the sort criteria provided by the view.

Additional Information

If I select a sort criteria first, then apply a facet, the search results are narrowed down based on the applied facet and everything seems to work well.

If I apply the facet first, then select a sort criteria, the applied facet is reset and the search results that are shown revert back to how many there were before the facet was applied. For example, let's say that I sell 4 cars on my website, 2 red cars and 2 black cars. I search for "cars" and 4 items are shown in the results. I then apply a facet based on taxonomy terms for the color "red". There are only 2 red cars, so the search results are now only displaying 2 results. If I sort the results by "Price" the facet for the color "red" is removed. This causes the search results to revert back to the 4 items that were originally displayed for the search term "cars".

I want to be able to sort the results after a facet is applied and have the applied facet not reset itself.


texts: Export and import content from one drupal site to another?

texts:
I want to export content with comments and user data with content relation from one Drupal site to same version of another site. In another site there is no content and users data it has only some new module installed and it's configuration.

For this which is best way migrate/ node_export/ Backup and Migrate


texts: Call python from module and receive output

texts:
I am creating a Drupal 7 custom module and would like to call a python script from the PHP and receive back some output from the script.  I am running on a Linux OS and have the following so far:

    $command =  "/usr/bin/python " .  drupal_get_path("module", "mycustmod") . "/pycriptdir/pyscript.py ../../../../default/files/shapefiles/CherokeeCounty.shp";
    $output = shell_exec($command);

Within the python script I am using echo to pipe the output.  However, I do not get anything back into the output variable as I would expect.

Any advice on how to get this to work would be greatly appreciated.

Thanks,
Derek


texts: How to get or extract the link path for terms in View

texts:
I have created a Taxonomy Term view in Drupal 7,  and list out all my terms through "Taxonomy term: Name" field.

Now, I wonder how to extract the link path of each term so that I can reconstruct and adding the passing value through the url.

e.g.

http://www.domain.com/fruit/apple?quantity=100


texts: how to fetch value from grouped form fields after ajax is fired under conditional select type

texts:
I also used dpm($form_state->getValue('input_select','text'));
  and dpm($form_state->getValue('input_select','body'));its after the ajax handler is called...

what is the right way to fetch value for grouped form fields in drupal 8 ?
and I need to achieve this programmatically not via modules

<?php

namespace Drupal\Mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class Untitled extends FormBase
{
    public function getFormId()
    {
        return 'Mymodule_test_form';
    }

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

        $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Title of the field'),
    '#description' => t('Enter the Desired title'),
    '#size' => 60,
    '#required' => true,
     '#default' => ($form_state->isValueEmpty('title')) ? null : $form_state->getValue('title'),
  );

        $form['type'] = array(
    '#type' => 'select',
    '#title' => t('Type'),
    '#description' => t('Add or edit'),
    '#options' => array_combine(array(t('Add'), t('Edit')), array(t('Add'), t('Edit'))),
    '#default' => ($form_state->isValueEmpty('type')) ? 'Add' : $form_state->getValue('type'),
    '#required' => true,
    '#ajax' => array(
      'callback' => '::ajax_handler',
      'wrapper' => 'input-fields',
    ),

  );

        $form['input_select'] = array(
    '#type' => 'container',
    '#attributes' => ['id' => 'input-fields'],
  );

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

        return $form;
    }

    public function ajax_handler(array &$form, FormStateInterface $form_state)
    {
        if (($form_state->getValue('type')) === ('Add')) {
            $form['input_select']['text'] = array(
          '#type' => 'textfield',
          '#title' => t('Title of the add Block'),
          '#description' => t('Enter the Desired title'),
          '#size' => 60,
          '#required' => true,
          //how to get value of field text if add is selected
           '#default' => ($form_state->isValueEmpty('text')) ? null : $form_state->getValue('text'),
        );
        }

        if ($form_state->getValue('type') === ('Edit')) {
            $form['input_select']['body'] = array(
            '#type' => 'textarea',
            '#title' => t('Title of the edit Block'),
            '#description' => t('Enter the Desired feedback'),
            '#size' => 60,
            '#required' => true,
            //how to get value of field body if edit is selected
             '#default' => ($form_state->isValueEmpty('body')) ? null : $form_state->getValue('body'),
          );
        }

        return $form['input_select'];
    }
}

thank-you for your efforts


texts: How to show nodes where the user is (not) in the reference field with Views?

texts:
I have a content type with a multiple-values user entity reference field.

I need a view that shows (as two pages or within one view) (a) all the nodes where the user IS referenced and (b) all the nodes where the user is NOT referenced.

There is a relationship to the user reference field and a contextual filter (uid of the logged in user). This "positive" works and shows the nodes where the logged in user is referenced

But the view where the user is not referenced does not work. Is there a way to "negate" the contextual filter (uid of the logged in user)?

I have tried it in one view with an exposed filter (current user), but I could not solve the problem of having multiple user references. I tried the VIEWS distinct feature and the views_distinct modules.


texts: Is there any way to restore deleted core block in Drupal 8?

texts:
How to restore core/menu or other programmatically created blocks if they have been deleted in D8?

I remember in D6 and D7 was no possibility to delete programmatically created blocks.
But D8 allows to delete any block. If I delete custom block, I can create it again manually, but if I delete for example Page Title block, there is no way to return page title block to my site.


texts: Why is my server complaining that Ruby isn't installed when browsing Omega theme directories? (& how to stop it)

texts:
Earlier I asked about how to disable the SASS / Ruby stuff in Omega 4. As I understood it from that answer plus other reading, the SASS / Ruby compatibility in Omega 4 does nothing until the user tells it to compile SASS into CSS via Compass or Guard, and can be ignored - and that it's normal to not install Ruby on production servers for Drupal sites using Omega 4, since SASS is a development tool.

Great. I uninstalled Ruby from my production server.

Now I'm seeing this strange error message, while manually copying layout template files from Omega theme to my subtheme:

It seems to be trying to trigger some Ruby process while performing a simple cd change directory operation in my Omega theme folders - and it's failing, complaining that Ruby is not installed. This is interfering with normal activities.

When navigating between Omega 4 subtheme directories using cd in SSH, I've also noticed surprising Ruby-related messages.

What's going on here? Something Omega 4 related appears to exist which is trying to respond to folder access attempts by launching a Ruby process. What is it, and how do I get rid of it?

(either that, or my server is haunted)


texts:
So I've got a basic page 'home' I want to use as my homepage. But when I make one and publish it to front page, I only see a summary, like it's an article. And if I don't publish it to front page, it's just not there, even with homepage link setup.

So basically I want text on my front page without the "read more" button, just the full text.


texts:
Right now there are some security updates for Symfony:

curl -sS https://get.symfony.com/cli/installer | bash
echo y | ~/.symfony/bin/symfony self:update
~/.symfony/bin/symfony security:check

Symfony Security Check Report
=============================

2 packages have known vulnerabilities.

symfony/cache (v4.1.6)
----------------------

 * [CVE-2019-10912][]: Prevent destructors with side-effects from being unserialized

symfony/phpunit-bridge (v3.4.22)
--------------------------------

 * [CVE-2019-10912][]: Prevent destructors with side-effects from being unserialized

[CVE-2019-10912]: https://symfony.com/cve-2019-10912
[CVE-2019-10912]: https://symfony.com/cve-2019-10912

Note that this checker can only detect vulnerabilities that are referenced in the security advisories database.
Execute this command regularly to check the newly discovered vulnerabilities.

These can be easily updated:

composer update symfony/cache symfony/phpunit-bridge --with-dependencies

The question is, should we do these dependency updates ourselves or wait for the next Drupal core release that includes them?

For example, I'm thinking about a scenario where we would update a Symfony package that is a Drupal core dependency and something would go wrong with the update because the updated dependency hasn't been fully tested with Drupal.


texts: How to add a result count in exposed filters?

texts: For theming purposes, I need to display the views results in the exposed form.  Right now, through the UI, it's easy to add "Global: Result summary" to the views header, section.  But how would one display it within the exposed form?


texts: In Behat How to Stage Link References in Table Nodes

texts:
I have a Link field on an article that allows both internal paths and external URLs. How can I stage that type of content in the table node for the article?

(machine name: field_url)

I tried to use:

| field_url:title | field_url:uri |
| Test            | http://a.com  |

But the link Handler throws an error because when you use that format the array keys are 'title' and 'uri' instead of numbers based. (If I change LinkHandler to use the keys it actually works, but obviously breaks other things.)

As for the internal content, I've done entity reference before and they've worked on regular entity reference fields. But when I do something like:

Given "article" content:
| title                  | body       |
| Test Reference Article | Test body. |
And "event" content:
| field_url              |
| Test Reference Article |

The database gets populated with:
field_url_uri = e
field_url_title = T

Has anyone made this work?


texts: Form with managed_file value as link in email

texts:
Like the title says I want to make managed_file value to be a link on form submissions in the email.

Webform has this option. When a user uploads file, on the email form submission there's a link with the path of the uploaded file. I want to achieve this with custom module.
This is my code:

<?php

function mymodule_page($form, &$form_state) {
    $form['description'] = array(
        '#type' => 'markup',
        '#markup' => t('Add description'),
    );
    $form['file'] = array(
        '#type' => 'managed_file',
        '#title' => t('Upload image'),
        '#upload_location' => 'public://files',

    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
        '#submit' => array('mymodule_page_submit'),
    );

    return $form;
}

function mymodule_page_submit($form, &$form_state) {
    $file = file_load($form_state['values']['file']);
    $file->status = FILE_STATUS_PERMANENT;
    file_save($file);

    //dpm($file);

    $description = $form_state['values']['description'];

    $params = array('file' => $file->uri, 'description' => $description );
    drupal_mail('mymodule', 'mymodule_news_mail', 'myemail', language_default(), $params);
    drupal_set_message(t('Message sent!'));
}

/*
** Implements hook_mail().
*/
function mymodule_mail($key, &$message, $params) {
    switch($key) {
        case 'mymodule_news_mail':
            $message['subject'] = t('Hello');
            $message['body'][] = t('This is a test');
            $message['body'][] = t('Image upload: @file', array('@file' => $params['file']));
            $message['body'][] = t('Description: @description', array('@description' => $params['description']));
        break;
    }
}

As you can see it from my code I'm saving the file properly into the server. After that with dpm($file->uri) I can see the string public://files/file_name.

How can I display the link from the path of the uploaded file on the email, so will be able to click on the absolute path?


texts: Remove drupal message "field is required" from webform validation

texts:
So when a webform is validated it sends a drupal message "X field is required", and creates a red border around the field.

For our project the red border is enough, how would I go about removing Drupal messages from triggering during validation?


texts: Which type of entity should I use for editable homepage content?

texts:
I have a set of social media links that I want to display in both the header and the footer, but I don't know where to put this content so that it is easily editable by users.

Right now I am using Panels and Views, but the links would be in the page.tpl.php, which has the header and footer areas.

I am thinking I could make a block, but it looks like you need to know the ID of a block to render it.

Is there a way to add a node, block, content pane, or mini panel and render it inside page.tpl.php?


texts:
I have three user roles

Merchant
Seller
End User

Merchant has more permissions privileges than Seller. Merchant can become a seller or an end user. When i created a user, i assigned all three roles to that user. But when the user is logged in, by default he should only have Merchant privileges. But he can switch to seller or End user from a drop down. The user will not have all permission privileges (Merchant  + Seller + End User) at a time. He will only have a single role at a time. Is there any way to achieve this.


texts: integration Webform and registration module

texts:
I want integrate Webfoem and registration user module.so , When a user fill a webform, some fields in that webform put in user table , and he/she insert in user list in my site.
and I should active it our delete from users.

I have multiple Webform for registrations, and I want for each form change user role.


texts: Attach Entity "comment" to Entity "file"

texts:
Files (images) are uploaded within a content type with plup and plupload. These images are then displayed through a view.

I would like to have a "commenting" functionality for each uploaded image. I used file_entity to have the images being considered as entities so that each of them can be treated individually within a node.

Drupal built-in comments can only be attached to nodes so I have used reply to have the "commenting" functionality working as an entity.

Now I have a hook_node_insert() in which I loop through the images but how can I create a comment field for each of them?

function MY_MODULE_node_insert($node) {
    if($node->type=="my_content_type"){
        $pictures=$node->field_photos['und'];
        foreach ($pictures as $picture){
            // now what?
        }
    }
}


texts: Print primary and secondary tabs separately

texts:
I am creating subtheme of bartik theme.

According to page.tpl.php file of Bartik theme it shows that tabs can be printed by following code.

<?php if ($tabs): ?>
  <div class="tabs">
    <?php print render($tabs); ?>
  </div>
<?php endif; ?>

The above code prints primary and secondary tabs at a single place.

Now i want to print primary and secondary tabs seperately in template file.

Is there any variable which gives me the primary and secondary tabs seperately ?


texts: Can I somehow edit libraries.yml files from the backend using the admin panel?

texts:
In my Drupal project, we load custom CSS for some of our specific pages. Right now I do all of these modifications programmatically.

But what our manager wants is to create it manually in the admin panel. Uploading the CSS file in the new content type I'll create.

I'm a bit worried because I add these custom CSS we had in the libraries.yml like this:

Is there anyway they can edit this yml file in the admin panel? Or is there any better ideas I can do when adding custom CSS?

EDIT: I need to setup an advanced rule. In our project, each of our articles contain categories. And we apply different CSS files in some special categories. So basically what I'm doing is I query the categories of the article and inject the custom CSS. I attach the CSS like this in the page_attachment.inc:


texts: How to add a table to a Webform or EntityForm

texts:
I am using a Drupal 7, and I want to have a customized form which includes:

Simple questionnaire with textfield, checkboxes and dropdown lists.
(I am able to configure this part of the form)
The same form includes a table with multiple rows and columns where users can enter their data. I am not able to configure this.

I tried webform module + webform table module, but I am not getting the expected result. Then I tried entityform module(a better module than webform) but I am not able to configure a table.

Please suggest me a way to include a dynamic table in my customized form through entityform module or any other module.


texts: How to always show poll results view instead of vote view on poll single node?

texts:
The default poll runtime settings don't fit our needs. We need to have a time window with a specific start date and a specific end date. When it's too early the button and radio inputs will be hidden. I solved that by a simple hook_form_alter(). But when it's too late the results view should be displayed and I can't find out how.

All anonymous users.

I know I could hook_init() everybody to the node/%nid/results URL. Problem is, this URL gets unavailable when the user already voted. How does Drupal know if someone already voted? How can I call the clean URL alias of a node and ensure that always the results view will be displayed even when the poll settings still say the poll is open?


texts: When creating a 'status' entry with the statuses module, stop it from creating a double post

texts:
Am using statuses 7.x-1.0-unstable4+43-dev. I've spoken to some of the "maintainers" on the drupal.org site and none have been able to answer this question, blamed another module or have ignored my question. So I'm taking this question to the greatest site on earth, Stack Exchange!.

When I create a 'status' from a user profile page. It create 1 entry in the DB but displays a duplicate of the entry on the user page. According to the one of the maintainers, its an issues with views. I've tried to tinker with views to no avail. I was also told it was a problem with one of the contrib submodules... The problem with that is.. I ONLY HAVE THE MAIN MODULE ENABLED! So, do you gurus have any idea why this would create a duplicate display of a single entry in statuses?


texts: How to use articles, taxonomy, views, and filters to set up a content navigation scheme?

texts:
Right off the bat, I'd like to let everyone know that I'm brand new to Drupal, and while I've been making progress using the excellent short video tutorials on LevelUp Tutorials, I'm missing some concepts.  Here's my use case:

Drupal 7

I'm using a taxonomy to establish the relationship between NCAA football teams, their respective conferences, and the names of their stadiums.  It looks like this:

Name: NCAA 1A Conferences

SEC
-Missouri
--Faurot Field
-Ole Miss
--Vaught-Hemingway Stadium
-South Carolina
--Williams-Brice Stadium ...

and so on.

I'm attempting to set this up so that I can:

Use the team names as a field in an "Event" article (Home Team or Away Team)
Automatically populate a block on my custom home page with the home team's stadium. The block is a view that pulls the 2 closest "Event" articles (games) and displays the "Event" title, time remaining until event, number of comments on the event, and hopefully the stadium in a tabular format.
Create a url alias scheme similar to:    ncaa/sport/conference/school
and create pages at each level.

  ncaa/football/

would eventually return a view with a table of the conferences and their respective teams, linking both to

  ncaa/football/division/conference/
  and
  ncaa/football/division/conference/school

which would display links to the respective schools or the school's information and game schedule, etc.

Create a menu and/or filter that displays in sidebar 1 (or anywhere, really) that would allow users to filter through created events based on their relationships to the items in this taxonomy.

Were I coding this from scratch myself, I'd probably already be done with it, but I really want to get a good grasp of Drupal and develop an understanding of the core concepts.

Now, I understand that there is a lot here, and I don't expect anyone to hold my hand through the entire process.  I need help understanding how and why to use articles, taxonomy, views, etc. in such a way to accomplish these tasks.  It may be that I'm approaching this problem in a very non-Drupal fashion, and I'd really appreciate someone talking me through that bit.

Bottom line: Don't give me a fish, help me make a fishing pole.  I'd like to accomplish as much of this as possible without installing a bunch of extra modules so that I learn to get the most our of the core functionality.  I've already got Chaos Tools, IMCE, CKEditor, Views, Webform, Pathauto, Calendar, and Context.
Thanks very much, and please let me know if you need any more information.