texts:
I am trying to use with Javascript in Drupal 8. I took an example from official drupal website, which I got it from https://www.drupal.org/project/examples and modified the code of js_example to incorporate sDashboard library.

The js_example.libraries.yml includes:

# A simple script using jquery ui accordion.
js_example.accordion:
  js:
    js/js_example_accordion.js: {}
  # Build up our dependencies for this page as a library. Our accordion script
  # needs jquery.ui.accordion. You can find the core scripts under core/assets/.
  dependencies:
    - core/jquery.ui.accordion
    - core/jquery

js_example.sdashboard:
  js:
    js/jquery-sDashboard.js : {}
  css:
    component:
      css/sDashboard.css: {}
  dependencies:
    - core/jquery
    - core/jquery.ui
    - core/jquery.datatables

The example module includes a Controller which I modified as:

public function getJsAccordionImplementation() {
    $title = t('Click sections to expand or collapse:');
    // Build using our theme. This gives us content, which is not a good
    // practice, but which allows us to demonstrate adding JavaScript here.
    $build['myelement'] = array(
      '#theme' => 'js_example_accordion',
      '#title' => $title,
    );
    // Add our script. It is tiny, but this demonstrates how to add it. We pass
    // our module name followed by the internal library name declared in
    // libraries yml file.
    $build['myelement']['#attached']['library'][] = 'js_example/js_example.accordion';
    $build['myelement']['#attached']['library'][] = 'js_example/js_example.sdashboard';
    // Return the renderable array.
    return $build;
  }

and there is an accordion.html.twig where I added the code for displaying the sdashboard widget. It is given as:

{{  title }}

  .... accordion here ...

Now when I am trying to run the example, I get the error:

ReferenceError: $ is not defined
$("#myDashboard").sDashboard({
accordion (line 299, col 3)
ReferenceError: Flotr is not defined
factory($, Flotr);

Isn't this the usual way of using any external library in drupal. How do I use other libraries that I may need like sDashboard, etc?


texts: Why are new users having their role deleted on signup?

texts: Today my client added some new users & gave them a role, and checked 'Notify user of new account'. The users clicked the email link, entered their password and all was well - except that the role they had been given had been removed, so they had no useful access.  I've never seen this before, and in replicating it I can see that the role is removed at the point where the new user clicks save on their new password.  I'm  so puzzled by this, as we're at Drupal 7.69 which hasn't changed for a while and I can't see that anythig else has changed.


texts:
I was wondering if it's possible to replace the default commerce flow with my own custom flow.
As far as I know the default flow is following:

Add individual products to cart on Product's detail page or in Products View
Go to cart and proceed to checkout
Add shipping & billing information
Complete the payment

My flow need to be a bit different. I would like to create View of Products (my products are entry-tickets for an attraction) where user can select quantity of each Product he would like to purchase. I know this View can be AJAXified to change total price dynamically according to quantity of each product. When customer selects all tickets and quantities I need to send him to second page of my Multi-step webform where he enters shipping & billing information and finally confirms / fullfils the payment. After successful payment confirmation / fullfilment I'd like to display the third page of Multi-step Webform where is only confirmation and "thank you" message.
I've read through Commerce 2 documentation and I know how to change Order & Checkout workflows, but I'm not sure if I can use Multi-step Webform where the steps are following (as described above):

Step 1: Select quantities of each Product in Products View (10 products in total - ticket types)
Step 2: Fill shipping and billing information
Step 3: Display confirmation message

The general idea is to skip the cart step where I need to go to cart page and instead realize whole flow as a 3-step Multi-step Webform.
Thanks!


texts:
I am creating a content type in Drupal - a content management system for our business rules.  This content type will ultimately contain about 40 fields.  I notice that for each field I create for the content, Drupal creates a table in MySQL.

It sounds like when I go to query the content in MySQL from a remote system using, say, JDBC, will I need to create a query joining 40 or so tables?

Does that sound right?  Can I be doing something wrong?  I cannot believe that a query, even with adequate indexes in place, would be performant when 40 tables are joined together.


texts:
Hoping to get some advises from experts here regarding the Menu Local Task on user/uid/edit page. You see, I'm taking over a project at the brink of death. I have no idea why they hide all the local tasks tab.

I know that showing it on page.tpl.php is as simple as "print $tabs", however the fact that i am using splitting User/uid/edit pages into two (using EditProfile modules) complicates thing a bit.

My objective here is to show that local tasks (View/Edit Profile/Account Settings/Notification Settings) on templates/edit/edit-acct-settings.tpl.php page.

So far I could make that happen by this line on that template page.

if ($tabs = render(menu_local_tasks())): print $tabs; endif;

But, I'm sure there's a friendlier way to do this.
Again, I have no idea how they made the tabs disappear.

And it came rendered as normal list, not tabs. And I dunno how to exactly theme it if it's the current page. Hoping he "Edit Profile" would go bold or something when I'm on Edit Profile page.

Any advise appreciated. TGIF!


texts: Migrating multiple values into a single file field in Drupal 7 with Migrate 2.2

texts:
I have a file field that can have multiple downloadable files for an image node type. These images will have several versions (psd, jpg, eps) that will be downloadable. I would like to be able to append multiple values to this field. How would I do that when they are coming from multiple source columns (i.e. eps_filename, jpg_filename, psd_filename)?

I found related documentation here: http://drupal.org/node/1012810 But that documentation is for taxonomy terms where the details of the value can simply be a string with a separator. For this I am using MigrateFileFieldHandler::arguments(), so I can't just give it a separator.

Further what I would like to do is also be able to come back later and append more files to the migrated nodes. This is because the larger files will take longer to get on the server, so their smaller counterparts (jpg, png, etc) will be loaded first and then adding the eps files later. Now I already figured out how to update the previously migrated nodes using systemOfRecord. But I am not sure how to append to a multi-value field.

I am using Drupal 7 and the Migrate module version 2.2. Here is some sample code I am using for migrating the data initially into the file field.

$jpg_arguments = MigrateFileFieldHandler::arguments(NULL,
  'file_link', FILE_EXISTS_RENAME, 'en', array('source_field' => 'jpg_name'),
  array('source_field' => 'jpg_filename'), array('source_field' => 'jpg_filename'));

$this->addFieldMapping('field_file', 'jpg_uri')
     ->arguments($jpg_arguments);

I suspect the trick is using the prepareRow() function. But so far I have not been able to get that to execute yet.

Any ideas? I really appreciate any help.

Thanks!


texts: Create version of site with no header/menu?

texts:
So what I need is a copy my website without the header or navigation menu (it will be used in a frame for another site) but using the same database. I've considered theming the pages based on parameters in the url (e.g. www.example.com/?simpleview=true) but I can't think of how to append "?simpleview=true" to the end of all the links on the page so when they click, it stays.

If there is an elegant solution to this, it would be appreciated... otherwise I will have to make do with a messy one. :P


texts: How-To call a module when a user clicks a node title or read more link if($page)

texts:
I would like to call a module from node.tpl.php like so (based on node id):

//This is my node--job_post.tpl.php

   <pre>

   <?php
         if ($page):
    $nid = $node->nid;
  switch($nid){
  case 4:  CALL A MODULE FOR NODE ID 4
  case 5:  CALL A MODULE FOR NODE ID 5
  break;
 }
  endif;
  ?>
 </pre>

If there is a better way to accomplish this , please let me know. Thank you in advance.


texts: Which contextual filter should I use to make proximity filter get the URL param as center?

texts:
I am following How to create a nearest node view / Sorting by proximity, which at the fist point says:

  Under Advanced, add a contextual filter returning the center entity's ID. For example, if you want to show the view on a node, as a block, select the "Provide default value" radio button and underneath for Type, select "Content ID from URL".

Which contextual filter should I use? I tried Global: Null, but it doesn't seem to be the right one.


texts:
I have a form which I have altered with hook_form _alter to set the #default_value. It works for most fields, but for some reason some are defaulting to the second value of the list. I did a dpm() and looked at the form structure, and #default_value is set correctly.

Any ideas?
The only other thing I might add: the source of the form is from the Addressfield module. I needed to hack it and add extra format handlers. It works perfectly, but again, #defaul_value has been giving me issues.

EDIT:
Here is the hook form alter code:

$form['customer_profile_billing']['commerce_customer_address']['und'][0]['howDidYouHear_block']['howDidYouHear']['#default_value'] = "Other Reason";


texts: Password strength with password type field on registration

texts:
On my site, I have 10 different registration forms it means altered register form 10+ times and added different field on different scenarios. So on another new registration form, I have to remove confirm password field as it was required according to design so I did this way.

function HOOK_form_alter(&$form, &$form_state, $form_id) {
  switch ($form_id) {
    case 'user_register_form':
     $form['account']['pass']['#type'] = 'password';
    break;
  }
}

So, as core's functionality we have password strength with the confirm_password field on registration and by changing confirm_password field type to password it also removes password strength that I really need with password field.

Is there any way to do that?


texts: How to change page title of Manage Fields screen based on bundle name?

texts: Is it possible to change admin screen page title based on bundle related to the screen. For example, I would like title of admin/structure/types/manage/datasheet/fields page to be Manage datasheet fields. Is it possible?


texts: Inserting custom social media icons to nav.bar ( tb-megamenu )

texts:
I have been playing around all day and have been trying to get my social media in my navigation bar to the far right for people to click on and be directed to my social media account.
I am  using tb mega menu for my navigation bar and haven't had any luck getting them in there without messing with my site..
what i've done.

created images put them in my images file on my theme im running
went to style.css and tried to put the images in along with the path and href to my social media account exp. facebook, twitter

hasn't worked I would like to hear from you guys or if anyone has some code that I can slip in and where it would help out a lot, thanks.
MY CODE  in style.css
}
div=social media {
facebook { background-image:url(/images/facebook.png); width: 40px; height: 40px; position: relative; background-repeat: no-repeat; z-index: 10; margin-left: 880px; margin-top: -91px; padding-bottom: 115px;
}
twitter { background-image:url(/images/twitter.png); background-repeat: no-repeat; width: 40px; height: 40px; z-index: 10; margin-left: 30px;
}
googleplus {background-image:url(/images/googleplus.png); background-repeat: no-repeat; width: 40px; height: 40px; z-index: 10; margin-left: 30px;
}
linkedin {background-image:url(/images/linkedin.png); background-repeat: no-repeat; width: 40px; height: 40px; z-index: 10; margin-left: 30px;
}


texts: Display comment box to the author of the node being referenced using panels

texts:
I am creating a project that needs ONLY the author of a node being referenced AND the author of the referencing node to participate on comments on the referencing node, a sort of customer support Question/Answer system where ONLY the node author of the referencing node and the node author of the referenced node can participate in the comments section. I am implementing this with panels.

So far i can show the comment block only to the referencing node author (Question author) using the following code which checks to see if node-author-id = logged-in-user id:

global $user;
if (arg(0) == 'node' && is_numeric(arg(1))) {
  // Get the nid
  $nid = arg(1);

  // Load the node if you need to
  $node = node_load($nid);
}

if($node->uid == $user->uid){
return TRUE;
} else {
return FALSE;
}

How do i also display this comment box to the author of the node being referenced?

Please note: The Question Content type and Answer Content type are two different content types

Thanks.

ps: I know about the Answers module as well as the Question/Answer modules. Somehow the best answer submodule included with the Answers7.x-4.0-rc2 module is able to let the author of the question flag an answer referencing his question as the best answer


texts: Drupal custom coding checkout redirect not working

texts:
I have used custom coding to add a product into a cart.

 $items['buynow/%'] = array(
    'title' => t('buynow'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('custom_module_my_form3',1),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
function custom_module_my_form3($form, &$form_state,$id) {
global $user;
$product_id=$id;
$product = commerce_product_load($product_id);
$quantity=1;
$line_item = commerce_product_line_item_new($product, $quantity);
$line_item_added = commerce_cart_product_add($user->uid, $line_item);
$order_id=$line_item_added->order_id;
drupal_goto('checkout/'.$order_id);
}

Product added succesfully in the cart but redirecting into checkout page doesn't work.It redirecting into home page.

I have created link for each product like buynow/product_id. I have also created a custom menu path like buynow/%.

After that put the above code in the callback by passing argument.


texts: Automatically add class to images added through CKEditor

texts:
I'm trying to add classes automatically to images which are added through CKEditor, I have spent considerable time trying to research this and found How to add class or attribute automatically to img tags in CKEditor? & Create new dom elements using dataProcessor.htmlFilter which hint at solutions that I can't get working.

I'm using the CKEditor module rather than WYSIWYG and found it's possible to add a new plugin using hook_ckeditor_plugin and my new plugin appears as a selectable option in the CKEditor admin, based on the 2 documents provided I managed to put together:

( function() {
  CKEDITOR.plugins.add('imageclass', {
    init : function( editor ) {
      var rules = {
        elements: {
          img: function( element ) {
            console.log(element);
          }
        }
      };

      // It's good to set both filters - dataFilter is used when loading data and htmlFilter when retrieving.
      editor.dataProcessor.htmlFilter.addRules( rules );
      editor.dataProcessor.dataFilter.addRules( rules );
    }
  });
})();

The problem is that nothing get's written to the console, I changed the line img: function( element ) { to $: function( element ) { which then writes all the elements at the root to the console, but all images, spans, etc. don't get written to the console as they are children of other elements (p, div, etc.) and I think this is something to do with the way CKEditor is integrated with Drupal and the options available via text formats.

I just don't understand enough about CKEditor and the documentation isn't easy to follow on how to move through more than just the elements at the root, unless trying to create this as a plugin is the wrong way to go.


texts: Image re-sizing while uploading via drupal 7 dashboard

texts:
I am looking for an option to re-size the images while uploading from a content type.

I can set the max upload size to 8 mb and while user uploads the images it should be resized to a lesser size automatically.

How can i do it?


texts: How to implement responsive social sharing button with counters?

texts:
I'm looking to implement some social sharing buttons on my website.

Requirements are

responsive
counters

I like the looks of the Ridiculously Responsive Social Share Buttons module, but they don't have counters.

Any ideas about how to implement this in a Drupal, maybe using some jQuery library?


texts: Login button not showing after upgrade to PHP 5.3

texts:
I upgraded our web server to PHP 5.3 as a bit of software requires it, and suddenly the login button on one of our Drupal websites has disappeared! Submit buttons from other Drupal forms have disappeared too.

I've looked in the source code of the page, and the form is indeed missing a submit button.

Is this a known problem? If not, how might I diagnose the error?


texts:
I have a Drupal 8 site with a form that I have to submit to another server using the REST protocol.

I have the following information.

server address
server port
form data

I want to submit that information to the other server.

Is there any function I can use in Drupal 8?


texts:
I am getting five instances items in my View row when I wrap image field inside my link field. This is what I have in the template file:

    <?php foreach ($fields as $id => $field): ?>
  <?php if (!empty($field->separator)): ?>
    <?php print $field->separator; ?>
  <?php endif; ?>

  <?php print $field->wrapper_prefix; ?>
    <?php print $field->label_html; ?>
    <?php //print $field->content; ?>

            <a href="<?php print $fields['field_news_link']->content; ?>" target="_blank"><?php print $fields['field_news_image']->content; ?>
            <?php //print $fields['field_news_image']->content; ?>

        <a href="<?php print $fields['field_news_link']->content; ?>"><?php print $fields['field_news_source']->content; ?>

  <?php print $field->wrapper_suffix; ?>
<?php endforeach; ?>

If I uncomment <?php //print $field->content; ?> and remove the linked image and the rest of my mark up, I don't get multiple instances of the item.


texts:
So currently I am using the maxlength module (https://drupal.org/project/maxlength) in order to enforce the fields maximum length and I have a view set up that is embedded to a php Rules action (Execute custom PHP code).

Basically if a field is smaller than the maxlength defined, I am looking for a way to output the value with spaces.

For example: Maxlength 5. Field Value: xxx. Output: "xxx  " (without quotes)

I can't seem to find the right module/php code to do this.

I think I have 3 directions I can go with this.

I have it save the spaces to the field based on the maxlength specified when saving the field. I don't like this option much since it actually adds spaces to the value in the database.
I somehow edit the view to display the spaces based on the maxlength of the field.
I edit the Rules views_embed_view php output.

Any help would be extremely helpful. Thank you.

Edit: I am using Drupal 7 by the way.


texts:
How do you theme stuff in Drupal 8? In 7, for example, if you had some data items you could call item_list, via the theme function, pass in a render array and get your markup back.

This is a great resource for those interested: Render API, but no examples that I can see.

How do I do this in Drupal 8? For example, how do I theme an image? Sure,
I can probably construct my render array, but does it then have to go off to a twig template or something. Are there any examples yet?

Thanks.


texts: Update the number of comments without refreshing the cache

texts:
I am running a local installation of Drupal 7 with the Disqus module installed.

I have created a view with a list of "blog" nodes, and the number of comments displaying through the view. The number of comments in my view does not refresh/update without clearing the cache in Drupal.

Is there a specific way to do this for Disqus, or automatically refresh the Drupal cache?


texts: Custom form values in hook_form_alter() not available in custom validate function

texts:
I'm modyfing a node form to add a few extra fields. On submit, I need to program some extra logic to these values then save them to the node object.
function module_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'my_node_form') {
    $form['custom_form'] = array(
     '#type' => 'textfield',
     '#title' => t('Custom field'),
     '#default_value' => 'enter custom text here',
    );

    $form['#validate'][] = 'custom_form_process_values';
  }
 }

 function custom_form_process_values(&$form, &$form_state, $form_id) {
    echo '
' . print_r($form_id,1) . '
';
    echo '
' . print_r($form_state,1) . '
';
    exit();
  }

When I go to node/22/edit and change "enter custom text here" to something else, and I submit the form, I only ever see "enter custom text here" and not the new text I entered. It seems that it does not carry the text through to the validate function. Also tried it in a submit function but the same problem occurs.
Why does this happen?


texts: How to delete message entities (message stack) of a special template depending on entity age

texts:
for the "Private Message" module, my Drupal 8 site uses the "Message" module (https://www.drupal.org/project/message) as substructure.
I would like to build a kind of notification center into the page, which should be possible to implement with the message stack (as I heard).
The trigger to generate such a message will probably be a custom module.
The message module also offers a kind of "auto cleanup", but unfortunately as far as I have seen only for all messages and not per message template.
In principle I only want a notification center, which is triggered at certain events and which cleans itself depending on the message type (e.g. only the last 10 messages of a certain template or delete all messages of a certain template which are older than 10 days).
In general, I guess cleanup does not work, as it would probably also delete the "private messages".
Any hints.


texts:
I use Drupal 7 with the Search API, and the Facet API modules.

I want to create a facet that shows all OG groups. When I click on an OG group all its content associated will be draw.

How can I achieve this?


texts:
I have a proximity search on views using Gmap and Location API, I've imported all the UK post codes into my zipcodes table in my database, and it all works great. The only thing I would like to change is the no results behaviour.

If a user enters a postcode, and there isn't a venue nearby, the map disappears, and I can show a no results message in its place.

What I would like to happen, is for the map to stay where it is, but showing all venues, with a message underneath saying "Please widen your search area".

Anyone know if this is possible? I've been searching for a similar post on Google, but can't find anything, as I'm not having any errors, just wondering if its possible, and can't seem to figure it out myself!


texts: Listing Child terms on clicking parent terms in views

texts:
I have made one taxonomy of faq and in that I have added terms in the format:
Parent 1:
            Child 1
            Child 2
Parent 2:
            Child 3
            Child 4
Parent 3
Parent 4:
            Child 5
So, as you can see, there are no child terms for Parent 3.

I made one view, in that I was able to show Parent terms. But I want to relate these parent terms to the respective child terms. For example, if I clicked on Parent 1, it should take me to the Child1 and Child 2 listing, then if I clicked on any of them, they would take me to the respective questions that I have added.
I researched and found out that this can only be done with relationship. So, if somebody knows the steps, mention them or guide me if I am wrong.

Thanks


texts: Currently any HTML added to the "More link" output in a view is sanitized.  This is undesirable for me.  How can this be changed so that this field is not sanitized?


texts:
I have a view accordion which works as it should, but I would like to add a play button to the thumbnails images that are inside the thumbnail!

I´m thinking: just a empty div inside of the a href, where the thumbnail image is placed. But how do I do this?

Any one have a suggestion on how to achieve this?


texts: How to pass a field value from a parent node to its entity referenced children nodes when saving the parent node form

texts:
Drupal 8
Here is the scenario
I have a Company > Department > Employee… in that hierarchy.
Companies are already created previously.
On the Department node add form, there is an entity reference field to reference a Company. On that same Department node form, there is another Entity Reference field that leverages Inline Entity Form to add + reference Employee nodes on the fly. These Employee nodes also have a Company entity reference field.
The goal is to pass the Company field value from the Department node to the referenced Employee nodes when the Department form is saved.
I figure this may be accomplished with the Business rules module, and/or a hook form alter. Tried both without any traction. Any tips?


texts: Cron Tasks not running in background, causing pages to take forever to load

texts:
We recently upgraded to D8 and I have been experiencing weird issues with Cron. Specifically, whenever the Cron is running, web pages are taking forever to load because cron is running some JS on the front end of any page you attempt to load. Specifically, it appears to be a timeout method that is holding up the page load.

NOTE: I will update this post and provide the exact JS file and function that is running on the front end the next time it happens to me. At the time of writing, cron wasn't running and therefore I couldn't inspect the web page to get the running method

I know it's not the CPU on the server because when cron was running it never got above 20% CPU utilization.
Isn't cron suppose to run in the background? Why would cron have a JS file being executed on every page, causing any page not to load until cron finishes?


texts: Why is this code using the global $user variable?

texts:
This is the code used by someone:

/**
 * @Implement of hook_comment()
 */
function mycaptcha_comment(&$comment, $op) {
  global $user;
  switch ($op) {
    case 'insert':
      if (isset($_SESSION['mycaptcha_ask_key'])) {
        // unset the information
        unset($_SESSION['mycaptcha_ask_key']);
      }
    break;
    case 'validate':
      if ($comment['mycaptcha_ask']) {
        // validate the information
        mycaptcha_ask_form_validate($comment['mycaptcha_ask']);
      }
    break;
  }
}

On the above code, why is he using global $user;? I see he doesn't use $user in his code.


texts: Migrate Specific File could not be copied to

texts:
I am struggling to get migrate to import images. I have a yml migration that says:
[error]  The specified file 'modules/custom/custom_migrate/assets/photos/' could not be copied to 'public://photos//photos'.

All the folders are 777. Just to try to eliminate any permissions. I cannot find anything that helps me figure out why. The tmp file is in the sites/default/files/tmp and 777. The folder where the images are is 777 and folders up to that folder are 777. I have searched and tried multiple little things and still no go.
Here is the yml file:
dependencies:
  module:
    - file
id: photo
migration_tags:
  - CSV
migration_group: null
label: Photos
source:
  constants:
    source_base_path: modules/custom/custom_migrate/assets/photos
    uri_file: 'public://photos'
  plugin: csv
  track_changes: true
  path: modules/custom/custom_migrate/assets/csv/profile.csv
  header_row_count: 1
  ids:
    - photo
  fields:
    5:
      name: photo
      label: Photo
process:
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - name
    -
      plugin: urlencode
  uri_file:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/uri_file
        - name
    -
      plugin: urlencode
  filename: name
  uri:
    plugin: file_copy
    source:
      - '@source_full_path'
      - '@uri_file'
destination:
  plugin: 'entity:file'
migration_dependencies:
  required: {  }
  optional: {  }

EDIT: Adding the Other yml file, hoping y'all can help me figure where the issue is coming from...
dependencies:
  module:
    - migrate_source_csv
id: profile
migration_tags:
  - CSV
migration_group: null
label: Profile
source:
  plugin: csv
  path: modules/custom/custom_migrate/assets/csv/profile.csv
  header_row_count: 1
  ids:
    - id
  #column)names:
  #  0:
  #    name: image_file
  #    label: Image file

  #keys:
  #  - id
  fields:
    0:
      name: id
      label: ID
    1:
      name: first_name
      label: First Name
    2:
      name: last_name
      label: Last Name
    3:
      name: birthday
      label: Birthday
    4:
      name: email
      label: Email
    5:
      name: photo
      label: Photo
    6:
      name: languages
      label: Language
process:
  type:
    plugin: default_value
    default_value: profile
  title:
    plugin: concat
    source:
      - first_name
      - last_name
    delimiter: ' '
  field_first_name: first_name
  field_last_name: last_name
  field_birthday: birthday
  field_email: email
  field_language:
    plugin: entity_generate
    source: languages
  field_photo:
    -
      plugin: explode
      source: photo
      delimiter: ;
    -
      plugin: callback
      callable: trim
    -
      plugin: callback
      callable: strtoupper
    -
      plugin: migration
      migration: photo
      no_stub: true
destination:
  plugin: 'entity:node'
migration_dependencies:
  optional:
    - photo


texts: Rendered Webform has no Javascript attached

texts:
I've created a simple filter that allows webforms to be rendered anywhere in a node with a tag like this: [webform:machine_name]

The code to render the form is as follows:

$webform = \Drupal::entityTypeManager()->getStorage('webform')->load($machineName);
$viewBuilder = \Drupal::service('entity_type.manager')->getViewBuilder('webform');
$formBuild = $viewBuilder->view($webform);
return render($formBuild);

It works insofar as the form is displayed, client-side validation is working.

BUT none of the webform-specific JS is attached (e.g. input masks don't work). I assume this is because Drupal doesn't know it needs to attach the libraries.

How do I attach those libraries? Preferably in a method that can be invoked from the code that renders the filter, as if it's in a separate place things would start to get more complicated.

EDIT:

Following 4k4's feedback, here's the code that I'm now using. It works as above, without the libraries being attached:

foreach ($renderArrays as $tag => $renderArray) {
  $renderContext = new RenderContext();
  $renderedOutput = $this->renderer->executeInRenderContext($renderContext, function () use (&$renderArray) {
    return $this->renderer->render($renderArray);
  });
  $metaData = BubbleableMetadata::createFromRenderArray($renderArray);
  if (!$renderContext->isEmpty()) {
    $metaData = $metaData->merge($renderContext->pop());
  }
  $result = $result->merge($metaData);
  $text = str_replace($tag, $renderedOutput, $text);
}
$result->setProcessedText($text);

For completeness, $renderArrays contains:

['[webform:machine_name]' => [
  '#type' => 'webform',
  '#webform' => 'machine_name',
]]


texts: Add t('String to be translated') to your database

texts:
I've altered a form where I set the save button text to t("Buy Product");

But how can I make sure that I can translate this string in admin/config/region/translate/translate ?

I've tried to add this

$conf['locale_custom_strings_en'][''] = array(
 'Buy Product' => 'Koop Product',
);

to my settings.php but no result. How can I make sure the string in my code can be translated in drupal itself?


texts: How to make different slogan for each content type?

texts: I have several content types, I want the slogan that shows up on the page to be different for each slogan. Is this possible?


texts: Deleting nodes did not remove the node-related menus

texts: Is there a "safe" way to delete all the existing content/pages/nodes from a Drupal 7 site, and delete corresponding menu entries?  When I deleted the nodes using the admin UI, my menu entries didn't get deleted?  What can cause this?


texts: What's the best option for responsive drupal theme using sass, Zen sub-theme or twitter Bootstrap

texts: I am going to start a new project using sass but not sure whether I should use twitter bootstrap and start fro scratch or use Zen. Any suggestion on which one to use and why?


texts:
I have been trying to figure out how to use the Batch API in an overlay via AJAX, but are not sure that's possible at all? - As far as I can see the batch API, when javascript is enabled, calls the misc/batch.js, which at status=100 performs a window.location to return to the page who requested the batch.

To my knowledge, it's not possible to catch and prevent this event (Without showing the user a popup with the choice of staying on or leaving the page). - So right now I don't see a way to achieve this without running batch as if, javascript was not turned on?

Am I missing some Drupal magic here?


texts: Is it possible to run functional tests without creating test tables?

texts:
My goal is to  speed up functional tests without tweaking the database. Is it possible to avoid the creation of Simpletests setup tables and use existing tables instead? I read this article where the author states :

Maybe the answer is Simpletest 2 which allows you to run on a "dirty" environment.

So is this "dirty" environement is the answer? If so, how to use it as setup ?


texts: How to use same view.tpl for some taxonomy terms

texts:
I have few taxonomy terms (taxonomy/term/1 taxonomy/term/2 ...etc ).
Every of that term has a different view.

I want to be able to use the same views-view--[myview]--page.tpl.php for more than one view.

The easiest way is just to copy the file and  alter the myview name to be the same of the each view.

Is another solution?

I use different taxonomy views because i have a FILTER CRITERIA of Taxonomy term: Parent term (= x) for every one.

Example:
taxonomy/term/1 has Taxonomy term: Parent term (= 1) to show all taxonomy terms that is child of taxonomy term 1.

Drupal 7


texts: Save checkboxes value into another checkbox field

texts:
I'd like to save the value of a checkboxes field which is link to a product once I save my content type.

I've created the code needed to create the product and the node. When the node is in creation mode everything appear as it should and my node get's save, the product created but I struggle to save the value into the field field_permission that I've added to the product type.

Permission field.

Label: Permissions
Machine Name: field_permission
Field Type: List(text)
Widget: Check boxes/radio buttons

The values inside this field are:

permission1|Permission1
permission2|Permission2
permission3|Permission3

I've selected the number of value to 3. I got my check-boxes field created. Great !

Then, I've created a content type and alter form to save a custom node. I had this form element which appear on the form.

    $options = array(
      permission1|Permission1
      permission2|Permission2
      permission3|Permission3
    );

    $form['permission'] = array(
      '#type' => 'checkboxes',
      '#options' => $options,
      '#title' => t('Select permissions:'),
    );

Then when I save the new node using a custom submit, I create a product and it works fine,
But:

I want to save the value selected inside $form[permission] and copy those values to the field_permission I've create onto the product type. I've read that I have to use the wrapper and call the newly created product. Fine. It works but the value aren't still save into my new field. Any idea How to save checkboxes values ?

Thanks.

function myform_submit($form, &$form_state){
global $user;

$node = new stdClass();
// Set content type
    $node->type = 'event';
    // Prepare defaults
    node_object_prepare($node);

    $node->title  = $form_state['values']['title'];

    $node->language = LANGUAGE_NONE;

    //create path with pathauto
    $path = 'mycontent' . date('YmdHis');
    $node->path = array('alias' => $path);
    $node->uid = $user->uid;

    //create new product type
    $price = $form_state['values']['field_cost']['und'][0]['value'];
    $extra = array(
    'sku' => 'event-' . drupal_hash_base64(microtime()),
    'title' => $node->title,
    'uid' => $node->uid,
    'status' => TRUE,
    );
$reg_id = _create_product('event_product', $price, $extra);

//add permissions value to the product
$product = commerce_product_load($reg_id);
$wrapper = entity_metadata_wrapper('commerce_product', $product);

$permissions = $form_state['values']['permission'];

    --- HERE IS THE PROBLEM --- How to copy those values ???

   foreach ($permissions as $key => $value){
      $wrapper->field_event_permission['#default_value'] = $permissions;
   }

$wrapper->save();

dsm($wrapper->getPropertyInfo());

   //save the field attached to the node
.....
   node_save($node);
}


texts: Limit currency for one product in Drupal Commerce

texts: I have enabled two currencies for price in Drupal commerce but I want to enable only one of them for one of products. At this moment I can see both of them in product creation time. Where or how can I set this?


texts: How to add a property to a field type having data

texts:
I have a custom field type. Now I need to add an additional property to it.

I added the new property to propertyDefinitions() and schema() methods.

What should I do in the update hook? The field type is already in use, and fields have values stored in the database.


texts: How to make a "term reference" > "taxonomy vocab" display alphabetically in a content type?

texts:
Hello I have a content type that has a field type > term reference using the "Check Boxes/radios buttons" widget.

When adding content using that content type the checkboxes (which are of course being populated by a taxonomy) arn't being displayed in alphabetical order which will be difficult for my client to use. I've tried setting the taxomony to alphabetical but that doesn't seem to have any effect on its display within the content type.

Help appreciated :)


texts: Filter taxonomy term attached to user field

texts:
I have a user that has a taxonomy vocabulary attached their account and a content type with the same taxonomy vocabulary attached to it.

How do I get a page view filter to only display the nodes that have the same taxonomy term that is attached to the user vocabulary?


texts: Cannot import Paragraph based Feature into new site

texts:
Perhaps someone with a bit more Features expertise can help me here.

I have a Drupal site with 25 or so Paragraph types that I would like to export (one by one) to its own contained Feature.

I installed the latest version of Features, and created a new bundle called Paragraphs. In this new bundle, I enabled Paragraphs as a Base Type so they are an exportable option.

I go back to the main Features admin, and click "Create new feature". I fill out the basic info here, the name of the feature, then I select the Paragraph Type I want to export and wait for all of the required dependencies to auto populate. I finish the export by clicking on "Write" which produces the module folder.

In the new Drupal site I want to import it to, I see it in the list of Features. When I go to enable the module, I get an error like:

  Error importing field.field.paragraph.text_editor.field_rich_text :
  Attempt to create a field field_rich_text that does not exist on
  entity type paragraph.

Except... this Feature should be introducing this field into the application and install it. The Paragraph just has a long text field for CKEditor, and there is no field.storage.paragraph.field_rich_text.yml file that is exported. Yet, field.storage.paragraph.field_rich_text is listed as a config dependency in the same said Feature.

Did I miss a step here? I basically want to export my Paragraph types as if they were Node types. I want to install them into a new Drupal installation without wiring them to any reference fields or Node types - I want to do that later.

Why am I getting errors like Attempt to create a field field_rich_text that does not exist on entity type paragraph.? I get a similar error for each Paragraph I try to enable, which are all made up of basic fields and nothing special.

Note: it looks like the auto detection doesn't quite work. For example, if I pick one of the Paragraphs from the list of non-exported Features on the overview page, the field storage definitions that are marked as a dependency in the output are NOT selected for being exported here.

I started over and removed all the exported Features, and created a new Feature. This time, when I picked the paragraph type, it still did not include the field storage definition for the field that is being bundled. When I selected it, exported it, this time it enabled on the new site, no error.

What is the proper way to do this? Do I have to go through one by one and simply ensure the field storage(s) are exported myself?


texts: How to add a css class to sidebar first render

texts:
I am new to drupal theme development . I am customizing a sub theme of zen and wants to change the background of sidebar-first. So I want to know where this sidebar_first render array is defined and how can I add the CSS class to whole sidebar-first also to the nodes within the sidebar_first render array ?

I tried within my templates template.php :

function zensub_page_alter(&$page) {
 $page['sidebar_first'] = array(
 '#attributes' => array('class' => 'page-columns')
 );
}

But this causes the sidebar-first remove !


texts: what will be the value for revision_id field . Records are inserted with csv?

texts:
I have created the field for the custom content type . I want to update field value for some node . So I am trying to upload with csv direct in the phpmyadmin .But I  want to know about the "REVISION ID" value . What will be the value for the particular field table

I have try to install FEEDS module but its also not working for drupal 8


texts:
I've installed the Rate Module in order to add a simple thumbs up/down rating system on nodes. By default it displays the average percentage (see below) but all I want is to display a simple counter of up/down votes.

Any ideas?


texts: SQL command to remove hypens from data value

texts:
A commerce site that I am working on has products titles and skus in the format of DS-PC-CDJ2000.

The client wants the each hyphen removing and replacing with a space; DS PC CDJ2000

There are hundreds of products so I want to do this in the database if possible. What would be a suitable command to run on the relevant database tables?


texts: Field collection item not visible to anonymous user

texts:
I have a field collection, 'related content', that displays inside the 'page' content type tpl. It is a 'field' in the page content type.  It  works perfectly fine while logged in as admin, but cannot be seen by the anonymous users.

UPDATE: I've actually determined that this has something to do with Organic Groups.  The 'page' that the field collection belongs to is a member of a group...the anonymous user can see this page, can see the body, title and other fields...however, I still cannot get the field collection to show up on the page even though the variables are available and can be dumped to the page...rendering the content using render() results in nothing, but works fine if logged in as admin.

If I simply do var_dump($content['field_related_content']) I can see that all of the information is there...however print render($content['field_related_content']) displays  nothing for anonymous users.


texts: Product reference field (autocomplete) length limitation

texts: I use taxonomy based pricing calculations with rules. There are 4 differrent taxonomy vocbularies used as taxonomy reference field. So  when I "bulk generate" the products, I become 1152 product variations. The field "product reference" on product display node is limited to 2048 characters so it is not possible to reffer all my 1152 variations. How to extend the limitation of product reference field?


texts: Drupal Module for arranging Nodes of special type into a table||chart

texts:
I'm trying to map Nodes of special Types on the basis of their field datas in a table or a chart.

The table should look like this:Table Example

Explanation: Table Header and first row are the datas of two specified fields. The node titles (rest of table) are mapped on the free table rows/columns according to their field values. Since i got no solution for this i tried to look for an approach with graphs. But it doesn't turn out as an easier way.

Maybe i've overlooked something. I would be really glad if anybody have a solution for this problem.


texts:
I have a custom taxonomy for my posts called "Continents" and they could be:

Europe, Africa, Antarctica etc...

Then I have standard categories like: News, Reviews, Interviews etc.

And 1 subcategory for some categories e.g. for News I have subcategories like (entertainment, politics, sport, science etc.)

My question is how to set up URL permalinks in Drupal, so I have these types of links for "categories":

http://example.com/africa/news/politics
http://example.com/europe/reviews
http://example.com/antarctica

but at the same time I need to access things like:

http://example.com/news/politics

that will include everything from these categories and not taking care of the Continents taxonomy item.

And at that same time I need to access the posts (details) like:

http://example.com/2013/12/17/conflict-in-kongo-continues

Could that be done via Drupal or not?


texts:
I would like to create user account using rules, after anonymous user creates a node and inputs his email to a email field. Before that I need to run a condition if the email is already in use.
What would be the easiest way of doing this? Using fetch entity by email or using custom php?
I read about user_authenticate function but I do not know how to use it.
Thank you for advice.


texts: How to get url alias of a link, when rewriting field output in Views

texts:
I have an image field in Views, for which I must use "Rewrite output" option. The output of the image field is this:

[field_image]

So, it contains a link to taxonomy term. But I would like this link to be the custom url for this taxonomy term, instead of raw Drupal path. My Pathauto pattern for taxonomy term is:

[term:vocabulary]/[term:parents:join-path]/[term:name]

But in Views, the [term:parents:join-path] token is not visible on the list of Replacement Patterns.

How to achieve this?


texts:
I am using hook_editor_js_settings_alter() to disallow HTML tags in Ckeditor. It is only working in node edit form, and Ckeditor is in edit mode. Wen I preview the published page it allows the tags in my disallow custom hook.

The following code was a test to disallow <h1> tags with the class name myHeader2. If I change the class name to myheader, it work in edit mode and published mode. Is the class name the problem?

use Drupal\Core\Form\FormStateInterface;
use Drupal\editor\Entity\Editor;

function mymodule_editor_js_settings_alter(array &$settings) {
  foreach ($settings['editor']['formats'] as $name => $value) {
    $settings['editor']['formats']['rich_text']['editorSettings']['disallowedContent'] = 'h1(myHeader2)';
  }
}


texts: Number of contents created by a user in a organic group

texts:
I am using organic groups. I have an organic group called A and its group content B.
Users have subscribed to group A and created  content for content type B.

Now, I created a view of users.
There are three columns.
One for the usernames.Second one for the uid. And in the third one I want to show the number of nodes of type B created by a user.
There is a contextual filter for organic group A.

I am unable to craete the view. Please help.


texts: Is it possible to show a view's page in the admin overlay?

texts:
I created a view with a page display, which has an path alias, say: node/*/something/somethingelse
Now I would like that, if someone clicks on a link leading to the above path, the view's page is shown in the admin overlay. I tried following:

function custom_api_admin_paths_alter(&$paths) {
  $path['node/*/something/somethingelse'] = TRUE;
}

But it does not work. What did I wrong?


texts: How to set the time as 09.00 - 10.00 , 10.00 - 11.00 in day calendar view display?

texts:
I'm creating a calendar of event content types by using the date and calendar modules.

I already know how to customize the time grouping settings to set the time from particular time to the other (from Calendar: How to limit the range of hours in Days display?).  Now I want to display the time as a duration like 09.00 -10.00 AM, 10.00 - 11.00 , 11.00 -12.00 , 12.00 - 1.00 format.  I also don't want to display the times which don't have an event at the time.

For e.g :

Event one - 09.00 -10.00 Am
Event Two - 10.00 - 11.00
Event Three - 12.00- 2.00
Event Four - 04.00 - 06.00

I want to display this as :

09.00 -10.00 - Event one
10.00 - 11.00 - Event Two
12.00- 2.00 - Event Three
4.00 - 6.00 - Event Four

This is the result I'm trying to get from the day calendar view display.  In the display, the time which doesn't have an event is not listed in the time column (e.g., from 2.00 - 4.00). Could anyone help me in this?

Thanks in advance.


texts: how to implement jquery image gallery in drupal theme tpl.php files?

texts: I am new to Drupal 7's theme system. i am creating a custom theme that have image gallery inside it.but i have no idea for implementing jquery image gallery in drupal theme tpl.php files. i searched many tutorials about image gallery in drupal theme. but most of them just show implementation of image gallery using views and gallery related modules. can anybody know tutorials series that show how to add js files in theme tpl.php file from scratch? and what kind of drupal variables are use for gallery purpose.


texts:
I want use or in EntityFieldQuery query,
I search and found this but I dont understand how can I implement this, please instead of refer to another link or article tell me how can I add or condition on propertyCondtion
my job dont handle with IN operation .


texts: AJAX request works locally but not in production

texts:
I have a really weird problem and I don't know how to solve it.

I have an AJAX request that works perfectly locally but does not work on Production. The goal of this ajax call is to show a little more info of a certain profile when the user clicks on a 'expand info' (you can find a similar logic on Linkedin on each contact profile)

The only difference between local and production is:

Locally I have an extra url slug 'localhost/extra_slug/drupal/urls/' (since is a MAMP subfolder)

Databases are exactly the same.

Any idea?

function personal_info_show_form($form, &$form_state, $profile) {
    // Set the id to identify this as an profile edit form.
    $form['#id'] = 'personal-info-form';
    // Save the profile for later, in case we need it.
    $form['#profile'] = $profile;
    $form_state['profile'] = $profile;

    $form['user_id'] = array(
        '#type' => 'hidden',
        '#value' => $profile->user_id,
    );

    // Add the buttons.
    $form['buttons'] = array();
    $form['buttons']['#weight'] = 100;
    $form['buttons']['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Contact Info'),
        '#weight' => 5,
        "#ajax" => array(
            "callback" => "ajax_personal_info_show",
            "wrapper" => "personal-info-replace",
            "effect" => "fade",
        ),
        '#attributes' => array('class' => array('button')),

    );

    return $form;
}

And here is the callback:

function ajax_personal_info_show($form, &$form_state)
{
    $html .= '';
    $html .= '
';

    $query = db_query(' select mail, phone from users, profile
                        where users.uid = profile.user_id
                        and users.uid = '.$form_state['values']['user_id'].';');
    $info = $query->fetchObject();

    $html .= '
';
    if (property_exists($info, 'mail'))
        $html .= '
email

'.$info->mail.'
';

    if (property_exists($info, 'phone'))
        $html .= '
phone number

'.$info->phone.'
';

    $html .= '
';
    $profile = load_user_profile($form_state['values']['user_id']);
    $form = drupal_get_form('personal_info_close_form', $profile);
    $html .= drupal_render($form);
    $html .= '
';
    return $html;
}

Update, added server responses:

This is the response on production:

[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","jquery":{"ui":{"datepicker":{"isRTL":false,"firstDay":0}}},"ajaxPageState":{"theme":"project_name","theme_token":"TbevKg4_EXU1ERHQXhU2NCysl0HRxzgmyggl5MbCj4k"}},"merge":true}]

And the response on locally (working):

[{"command":"settings","settings":{"basePath":"\/project_name\/","pathPrefix":"","jquery":{"ui":{"datepicker":{"isRTL":false,"firstDay":0}}},"ajaxPageState":{"theme":"project_name","theme_token":"8biI4MmRocc38QZ3nyuTwhQk7yFHaPbc87ugREkHYFA"},"ajax":{"edit-submit--3":{"callback":"ajax_personal_info_close","wrapper":"personal-info-replace","effect":"fade","event":"mousedown","keypress":true,"prevent":"click","url":"\/project_name\/system\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Close"}}}},"merge":true},{"command":"insert","method":null,"selector":null,"data":some_data_here","settings":null},{"command":"insert","method":"prepend","selector":null,"data":"","settings":null}]


texts:
I'm just getting to know Drupal. I've been manually recreating current Drupal 7 Views from a production installation into a new development install of Drupal 8.85. I've run into some differences between Drupal 7 and Drupal 8, as you might imagine.

In Drupal 7, many views are using Content: Nid (for the node ID), which doesn't exist in Drupal 8. I've read here and elsewhere it has been replaced by Content: ID, in Drupal 8.

That said, the dialog boxes for each look different when it comes to setting options and parameters. For example, Content: Nid has an option/checkbox for Link this field to the original piece of content. Content: ID doesn't have that option, as I can see.

Additionally, the Content:ID dialog has options not seen in the Content: Nid dialog, such as the options for Formatter, Thousand marker, and Display prefix and suffix.

Is Content: ID really the Drupal 8 equivalent of Content: Nid? Where are the options missing in Content: ID?


texts:
I have a few pages with sub pages as tabs. Each pages are in a custom menu. I'd like to convert the menu links to load each page using AJAX, is this possible?

I know how to load a page using a regular AJAX link, but not a menu, or menu tab link. One way is to replicate the menu links using AJAX and binding the events to the corresponding menu links, which works, but there must be a better way?


texts: Drupal Rules, create the SUM of a field decimal values

texts:
I m running a drupal 7 installation and I need to create a special routine for my site.

I have 2 content types -> "Orders" and "Reports".

The "Order" content type has a field with decimal values called "final_value". Any user can create an order with different "final_value" each.

What I need is when a user creates a new report, a rule must trigger and calculate the SUM of all orders she created from the last time she logged in.

Any ideas??


texts: Get the values of views fields in a Twig template

texts:
I have created a view that outputs 3 fields for each row. Just using views, i can get the output to look something like this:

<li>[Field1 Value] [field2 value] [field3 value]</li>

I have a requirement to set a data-attribute on the list items to on of the field values. Also, I want to wrap an anchor linking to the detail view of the content around all three field values.

I've tried using a twig template like views-view-fields.html.twig (too generic i know, but for testing purposes) but the values dont seem to be there. I can do {{ dump (fields|keys) }} and i see my fields there, but if i do {{ dump (fields.my_field|keys) }} then its just an empty array.

I also tried using a template like page--[name of my page created by views].html.twig but couldn't seem to find the values for those fields there either.

Any help on advice as to where I should be looking, particulary which twig templates I might create/override and how to get the values would be very much appreciated!


texts:
Possible Duplicate:
  hook_menu_alter() is not working

I have implemented a hook function hook_menu_alter in a module I have created. I have printed something inside that function call but nothing shows up. Though the function hook_init() is executed from the same module. The output of the hook_init shows up in the page but not from the hook_menu_alter even after clearing the cache. Do somebody has any idea regarding this issue?

function mymodule_init(){
print "here";
}

function mymodule_menu_alter(&$items) {
print "I am here";
return $items;
}


texts: Can't run drush from within website folder configured with IIS on Windows Server 2012

texts:
I am trying to setup Drupal 8 on Windows Server 2012 on IIS. I have installed PHP7.0 and Composer. Using Composer I then installed Drush globally using composer global require drush/drush:8.*. Drush was installed at C:\Users\Myusername\AppData\Roaming\Composer\vendor\drush\drush. I have set the Path variable for the user 'Myusername' to include C:\Users\Myusername\AppData\Roaming\Composer\vendor\bin.

The problem I have is that if I cd into the website folder as configured in IIS, and then run drush version, I receive the following error:

"C:\\inetpub\\wwwroot\\mysite\\vendor\\bin\\drush.php.bat" is not recognized as an internal or external command, operable program or batch file.

If I run the same command outside of the site folder as configured in IIS, then drush version executes successfully.

It seems that when run from within the web site folder it is trying to run drush from within the website project instead of using the globally installed drush.

Any suggestions on how to get Drush running for the site?

Updated:

After some experimenting it seems that when I run Drush it looks for the closest vendor\bin directory. If it is not in the current directory, it works its way up the parent directories until it finds it. If it can’t find it, it uses the globally set one. For example, if I run drush from either C:\\inetpub, C:\\inetpub\\wwwroot then will get this error:

`"C:\inetpub\vendor\bin\drush.php.bat" is not recognized as an internal or external command, operable program or batch file.

If I run drush version from outsite of C:\\inetpub directory then it works correctly.


texts: Alter Color module fieldset within theme settings form

texts:
I've set up Color module for my theme - it works pretty well, but takes too much vertical space (I have a bunch of colors).
What i'm trying to do is to alter system-theme-settings form to make Color scheme fieldset collapsible.
So here's my code:

function test_form_system_theme_settings_alter(&$form, &$form_state) {
  drupal_set_message('DEBUG: ' . print_r($form['logo'], 1));
  // Above line prints array of logo settings - so function works well

  drupal_set_message('DEBUG: ' . print_r($form['color'], 1));
  /* This line prints nothing and I get:
   * 'Notice: Undefined index: color in test_form_system_theme_settings_alter()
   * (line 16 of /var/www/sites/all/themes/test/theme-settings.php).'
   */
}

As you can see, i can't alter $form['color'] because it doesn't exist.
Here's the color_form_system_theme_settings_alter function.

Am i missing something?


texts: This has indeed been asked somewhere but still no answer. Is there a way to have domain access provide links like example.com/site1 instead of side1.example.com Thank you


texts:
I have a subtheme based off the Zurb Foundation Drupal Theme. The Zurb foundation theme defines the main navigation menus in it's template.php like so:

function zurb_foundation_preprocess_page(&$variables) {
    ...
    $variables['main_menu_links'] = '';
    if (isset($variables['main_menu'])) {
        $variables['main_menu_links'] = theme('links__system_main_menu', array(
            'links' => $variables['main_menu'],
            'attributes' => array(
                'id' => 'main-menu',
                'class' => array('nav-bar'),
            ),
            'heading' => array(
                'text' => t('Main menu'),
                'level' => 'h2',
                'class' => array('element-invisible'),
            ),
        ));
   }
   ...
}

and in page.tpl.php:

<?php if ($main_menu_links): ?>

    <?php print $main_menu_links; ?>

<?php endif; ?>

which works fine. I want to edit the HTML being generated (convert the links to uppercase to be precise).

I create a template.php in my sub template and add to it:

function mycustomtheme_menu_link(array $variables) {
    $element = $variables['element'];
    $sub_menu = '';
    if ($element['#below']) {
        $sub_menu = drupal_render($element['#below']);
    }
    $output = drupal_strtoupper(l($element['#title'], $element['#href'], $element['#localized_options']));
    return '
' . $output . $sub_menu . "
\n";
}

But this doesn't have any effect; the normal menu is generated with out my text value attribute. The docs says that the theme function (used by the Zurb theme):

  Generates themed output. All requests for themed output must go through this function. It examines the request and routes it to the appropriate theme function or template

so I would have thought that it would have detected the current theme (my subtheme) and called the appropriate hook caketoppercompany_menu_link when rendering the links, but this doesn't seem to be the case. Any suggestions?


texts: Compute values to display on the user profile page based on other user profile field values

texts:
I've added fields to user profiles:

subscriber (yes/no)
guest subscriber (yes/no)
print subscription expiration date
online subscription expiration date

On the user profile page, I want to display things like:

Because you are a guest subscriber, your subscription never expires.
Your subscription will expire on date1 [the later of the print and online subscription dates]. Please renew by date2 for uninterrupted service.
Your subscription expired XX days/XX weeks/XX months ago on date.

These are some examples to give the idea. I need to look at profile field values before the profile is displayed, do some computing, and then add additional, display-only fields to the page or modify the value of existing fields that are displayed on the page.

All I need is a clue about the approach. I already have a custom module, so using something similar to hook_form_alter will do nicely. I've read about 20 posts, but none that seem to match.


texts: How to troubleshooting a D7 website that doesn't load (Gateway Timeout)

texts:
A website of mine, using D7, suddenly doesn't load. I always receive a Gateway Timeout error.

The strange is that with a ftp client I can browse the website as usual

What are the steps I should follow to troubleshooting this situation?


texts: How to use #states with a container element?

texts:
I come from read this Using the Drupal 7 Form API states system to create conditions between form elements and I'm able to use the #states with an input element like the title (textfield element), the problem is that if I try to use a container element the #states doesn't works.

This code works:

$form['field_courriels_des_autres']['#states']['disabled']['input[name="title"]']['filled'] = TRUE;

This code doesn' works:

$form['field_preciser']['#states']['enabled']['select[name="field_salle"]']['value'] = 'other';

I think that the problem is that the field_salle is a container.


texts: How can I get the labels of values of a field?

texts: I have created a List (text) field that has key|label pairs as options. How do I get the label, when the key is what is stored in the node?


texts:
Image here:

I made this with Photoshop. The "URL" field is supposed to be a Link field (the Link module). But it seems that it only provides an optional title field but no way to add fields like this. Or should I create a new node type and add "Quality" and "Provider" fields then reference (the Entity Reference module) that node with this? Seems that adding those two fields are more ideal. Please advise. Thanks.


texts: Problem trying to create a views with tabs. Link of tab doesn't point to the path I set

texts:
I am trying to create a views with tabs:
so that a page that has several tabs, the View has a primary page that shows all Article nodes, a tab for all Event nodes, and a tab for Blog nodes.
Something should works like this:

"Content" button in menu links to /content,
"Articles" tab links to /content/articles,
"Blog" tab links to /content/blog,
"Event" tab links to /content/event.

However, with my work, this is what I got:

all the 3 tabs link to /content, instead of /content/articles, /content/blog, /content/event.

==========

Below is configuration of my view:

So basically, the tabs shows up, but the links of tabs are all pointed to /content, rather than their individual link.

What have I done wrong? Please advise. Thanks in advanced!


texts: Can I check a user is logged in using Services

texts:
I need to be able to integrate an external PHP script with Drupal 7. However because the script also connects to a MySQL database errors are produced when I include the bootstrap.inc, so I'm looking at using the Services module. Will this allow me to determine if the user is logged  in to Drupal, and if so get details about the user? If so, could you please show me how this could be done.

Also, is it possible to secure the server/service so that it can only be accessed by scripts on the same host?


texts: Custom form multiple file upload with different extension

texts:
I am working multi file upload functionality with different extensions(pdf,doc,png,jpg).
Following code is working fine for multiple images upload. I would like to know how this code modify for different extension like doc, pdf, png,gif etc.

function mymodule_form($form, &$form_state) {
    $form['file'] = array(
        '#type' => 'file',
        '#name' => 'files[]',
        '#title' => t('Upload some photos'),
        '#attributes' => array('multiple' => 'multiple'),
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),

    );
}

form mymodule_form_validate($form, &$form_state) {
    //Save multiple files
    $num_files = count($_FILES['files']['name']);
    for ($i = 0; $i < $num_files; $i++) {
        $file = file_save_upload($i, array(
            'file_validate_is_image' => array(),
            'file_validate_extensions' => array('png gif jpg jpeg'),
        ));
        if ($file) {
            if ($file = file_move($file, 'public://images')) {
                $form_state['values']['file'][$i] = $file;
            }
            else {
                form_set_error('file', t('Failed to write the uploaded file the site\'s file folder.'));
            }
        }
        else {
            form_set_error('file', t('No file was uploaded.'));
        }
    }
}


texts: Is there some way to compress CSS and Javascript only for certain users?

texts:
When I check the source of my web pages I am appalled at the amount of Javascript links in the page, but I have disabled the CSS and JS compression as I am often in development mode.

Is there some way to disable the compression for admins and developers and enable it only for viewers?


texts: How to specify the order of Javascript calls?

texts:
I have a call to drupal_add_js() in hook_block_view_alter() and another one in template_preprocess_page().

I need that the order in which the Javascript is printed in the screen of the browser is just as written. What is the preference in which the content is loaded in the page? Can it be controlled?


texts: Resetting outputted HTML markup to default?

texts:
I am trying to fix a site, which I did not build nor 'break'.

On a clean install of Drupal, the markup for a node's textfield, set to display inline, looks like this:

Foo:&nbsp;

Bar

On my problem site it looks liike this:

Foo:

Bar

I have turned off the custom theme and I have disabled the Display Suite module, cleared all caches - no change.

Are there any other obvious places I could look to find what is changing the outputted markup?

There are 250 modules enabled, so turning things off one by one is not really an option.

Thanks.


texts: Use fields from user's profile as title of view?

texts:
I have a view that displays, let's say, videos that each user has added. This view is shown in their profile. I'd like to use fields from their profile as the title of the view. Specifically, fields containing their first and last name. So for instance, I'd like the title to be "Ashton Kutcher's Videos."

I know that you can use arguments to alter the title of a view, but I can't seem to find a way to use the content of fields.

Additionally, because of a silly decision when building the site, I did not require users to enter their names. Therefore, sometimes I will need to display their username instead of their first and last names, conditionally.

Any suggestions?


texts: Custom page template for specific node - template inheritance

texts:
I'm trying to customize the page template for a specific node of a specific content type. This is what I have: Content type: Custom Page Node ID: 2

First, I need to customize all 'Custom Page' content nodes so I created a custom page template for them: page--custom-page.tpl.php

Then, I also need to customize a specific 'Custom Page' node so I created a custom page template for it too: page--node--2.tpl.php

But when I visit the node 2 page it is using the Custom Page (page--custom-page.tpl.php) template and not the page template I created specifically for that node.

How can I make the custom page template for that node work?


texts:
I have a view which is displaying a content type with text and image (1 column grid). Right now, the image is positioned under the text. Is it possible to position the image to the right?

Is this possible without using custom css? Or if it isn't, which css file should i be looking for? (Haven't done custom css yet)


texts: Can authenticaded users publish own content and see only own content?

texts: Besides the  module which has many interesting features, what's the best way to allow authenticated users publish content (based on a custom node type), but only allow such content to be seen only by an administrator (an specific role), or that same user only? Such content when published, will only be visible to a role type (administrator) and the user who published it.


texts: Custom warning on when viewing cart (anonymous users)

texts:
I am wondering with what mechanisms it would be possible to add a warning message to anonymous users viewing their cart saying: "Please log in with any of the listed services in order to proceed to checkout".

If possible I'd like to avoid changing the module's code in order to avoid future update problems.

Thanks for any help,
Best


texts: Grant permission to post a new node of content-type 2 if previous node of his content-type 1 has a state of approved

texts:
I'm using Workflow module for an Article Submission Contest website.

I have two main Role defined in system:

Referee
Participant

The whole workflow goes like this:

Participant user logs in, submit his summary article (content-type).
System sends an e-mail to participant regarding receiving the
article.
Referee user logs in, checks the submission then Approve/Deny the
submission (Workflow module).
System sends another e-mail letting the participant know the results.
If Approved, Participant may send his Full Article.
Referee Checks new submission, Approve/Deny and Publish to the
website.
System sends a congratulations e-mail letting the Participant know!

Everything is setup already and working just fine, the part that got me hooked in Rules module is:

  When the Referee Approves the Summary Article (Content-type 1) via workflow module, then it
  gives the access to Participant to Create new node on Full Article (Content-type
  2)

I'd really appreciate any hints, comments, answers, beers and coffee's you may provide to solve my issue! thank you.


texts: How can I modify Node Checkout module to downgrade product instead of unpublish content?

texts:
I’m using Commerce Node Checkout and the Expiration submodule. It’s a great module but I have a problem that I can’t solve.

I have 3 products:

product A: cost $0.1; expiration 999 years (free/stay always)
product B: cost $1.0; expiration 1 week (upgrade content for 1 week)
product C: cost $2.0; expiration 2 weeks (upgrade content for 2 weeks)

My problem is that when products "B" and "C" expire, the content is updated as unpublished.

What I need is that after expiration the content product is updated as an "A" product (the free version). Also need that the free product can be upgraded to "B" and "C" (for one or two weeks) but I think the way the module works is take the actual time and add the new one but I don’t want 999 years + 1 week. So I need that "A" is unlimited time but when upgrade takes the 1 or 2 weeks and when finished go back to unlimited.

Thanks in advance for help and guidance.


texts: Services module: what is the syntax of node.index parameters?

texts:
I'm trying to get the list of certain type nodes using xmlrpc and POST method. I'm constructing xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
<methodName>node.index</methodName>
<params>
   <param>
      <value>
         <string>0</string>
      </value>
   </param>
   <param>
      <value>
         <string>*</string>
      </value>
   </param>
   <param>
      <value>
         <string>type=forum</string>
      </value>
   </param>
</params>
</methodCall>

yet in return I get nodes of various types. I guess that type=forum is bad. What is correct syntax of this parameter?


texts: How can I have default field values for the node add form as arguments in the URL?

texts:
I have a path in drupal 6, which allow me to add new content with 2 fields completed. For example, path node/add/my_content_type/4/6 means that I am on page /node/add/my_content_type, and first field has value "Philip" and second field has value "Oleg". Those names are in database, because user put them in in another content type.
I try to do the same in Drupal 8, but I cannot put arguments after /mycontent_type/. So right now, on the /node/add/my_content_type I see a form with fields, I can select names in input select, but nothing shows when I put more arguments in url.
I will give an example:
I have a module with students and school trip. On custom content "students", I add students names in text input. Those names are saved in database.
Let's say, that my second content type is "trip".
I have a function, which allow me to add a trip, when students names are given. I can simply click add content 'trip' and select names in select fields, but I want to make it more simple and redirect to page /node/add/trip/4/6 where 4 is id of "Philip" and 6 is id of "Oleg". In this way I have a form with to fields already completed. It is posible in drupal 6, but no in drupal 8. Have can i do that?
I think that one of the problem could be the fact, that Drupal 8 require field "Title". So I have to modify url a little bit /node/add/trip/??TITLE??/4/6.
I need exactly this -> https://www.drupal.org/forum/support/module-development-and-code-questions/2020-04-27/webform-field-default-value-from-url
but for custom content :)


texts:
If I set up a menu callback with this function:

function mymodule_menu_callback($nid) {
    $node = node_load($nid);

    return drupal_render(node_view($node));
}

Then when the node is rendered it is missing the 'View' and 'Edit' tabs that you get on the regular node/[nid] pages.

How can I modify my callback so that it renders the node with the tabs?


texts: How to load all information Currency properties by currency code?

texts:
I used module Currency version 8.x-3.1 . I had currency Code so I looking up function to load all properties currency by currency code , What API or function do it ?

Thanks


texts: Configurable Action Form Builder Not Called by Views Bulk Operations

texts:
I have a configurable Action that I implemented back in VBO 8.x-3.8, and it was working fine.
<?php

namespace Drupal\my_module\Plugin\Action;

use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Entity\DependencyTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Some description.
 *
 * @Action(
 *   id = "assign_distributor",
 *   label = @Translation("Assign Distributor to users"),
 *   type = "user",
 * )
 */
class AssignDistributor extends ConfigurableActionBase {

  use DependencyTrait;

  /**
   * {@inheritdoc}
   */
  public function execute($entity = NULL) {
    $nid = $this->configuration['distributor_nid'];
    // Add the nid to field_distributors.
    $entity->get('field_distributors')->appendItem([
      'target_id' => $nid,
    ]);
    $entity->save();
  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    $access = $object->access('update', $account, TRUE);

    return $return_as_object ? $access : $access->isAllowed();
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [
      'distributor_nid' => '',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form['distributor_nid'] = [
      '#type' => 'entity_autocomplete',
      '#title' => $this->t('Select Distributor'),
      '#target_type' => 'node',
      '#required' => TRUE,
      '#selection_handler' => 'default',
      '#selection_settings' => [
        'target_bundles' => ['distributor'],
      ],
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    $this->configuration['distributor_nid'] = $form_state->getValue('distributor_nid');
  }

}

Since then, I also started using Views Bulk Edit to do some bulk editing, and we ran into an issue (like this one) where the  Apply button on the form will not work. At the same time, I figured out that what is not working with my custom action is that the buildConfigurationForm() method is not being called at all, and instead, it goes right to the execute(). method, and since no config data was entered, there is nothing to save.
I have tried rolling back versions of both VBE and VBO, and even the dev versions of both modules, but nothing has changed. It seems that the base problem is VBO. I will be filing an issue in the issue queue, but I'm curious to see if anyone has seen these issues with VBO besides me. Or, is there possibly something missing from my Action plugin above. It was working fine recently, so I'm not sure what might have changed that would have broken it.
UPDATE: One thing I have noticed is that my action extends the core ConfigureableActionBase, while VBE uses ViewsBulkOperationsActionBase. Both have worked in the past, so I don't see why one would still work and one wouldn't.


texts:
I'd like to create a tab like the one show in the screenshot for a simple contact address list.

or see this drupal site HERE

I have "contact one," "contact two,"  and "contact three."
I want to put some text under each contact section.

How can I achieve this?


texts:
I'm trying to add some titles in my registration form. This is a part of my registration form:

But now I would like to have some titles like the following:

I know that you can alter the registration form like this:

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

}

But I don't know which attributes or ... to use.

UPDATE:

I'm now trying out the markup.

This is what I do:

function xmed_form_user_register_form_alter(&$form, &$form_state, $form_id) {
    $form['account']['mail'] = array(
        '#markup' => '
testtttinnng
',
        '#weight' => 116
    );
}

But this just replaces my email content ...


texts:
All the other versions of jQuery are listed; version 1.6.x is missing.

What is the reasoning for not including 1.6.x in the jQuery Update module?


texts: Export exposed fields into a block with Views

texts:
I'm trying to create a search box from the exposed fields from a view. Is that possible? If I add a block display I also get the results.. I want only the fields, not both.

I also tried embedding a view with exposed filters inside a node, however, when I click "search" I'm not redirected to the view (the url is not constructed correctly: instead of website.com/view?exposed_field=test I get website.com/?exposed_field=test).

Any help is appreciated.
Thank you


texts: Can I call specific fields and field groups in a node.tpl using Ajax

texts:
I'm building a fairly large content type and some of what's in there doesn't need to be loaded until the user asks for it.

Is it possible to not load certain fields and field groups in the content type at first, but have them load via ajax and how would I do that in the node.tpl file?

Right now I have everything loaded and am doing a lot of hiding and showing, some of these are images and I'd rather not have the bandwidth hit on the user if there is a way I can load them asynchronously when asked for.


texts:
I'm trying to figure out how I can alter the theme for read more links. This is what goes on inside the node.module ~ line 1380.

$node->content['links']['node'] = array(
  '#theme' => 'links__node__node',
  '#links' => $links,
  '#attributes' => array('class' => array('links', 'inline')),
);

I know where are several ways to remove the read more links and add your own, but I just want to know where that theme function is stored and how I can override it like it can be done with fields using theme_field().


texts: How to prevent my site to crash when adding video content using the Media Colorbox module?

texts:
I'm having a lot of issues when trying to set up my Media Colorbox module.

For images, the Colorbox module works just fabulous, but whenever I try to add some video content in this Colorbox overlay, the site just crashes: I get a white screen, and the site just keeps loading. It's like it's looking for a file, but it cannot find it, although the link is correct because the file is actually there. The permissions for the files are correctly set.

I've tried many setups, tips and tricks documented on the Drupal pages, with no luck. What I want to achieve is perfectly demonstrated on this page, and although my code looks exactly the same, my content just wouldn't load.

I'm using the most recent versions of all modules:

Colorbox: 7.x-2.2
Media Colorbox: 7.x-1.0-rc3
File Entity (fieldable files) 7.x-2.0-unstable7

I don't think there is an issue with that.

I've tried any possible CSS class: colorbox-inline, colorbox-load, and colorbox-video. I cannot access those movies by surfing to them, although the path is correct.


texts: Count how many children have a reference to the parent

texts:
Explanations:

1) I have a node "parent"

2) I have 2 nodes "child"

3) Each child has a reference field (filled with a reference to the node "parent")

Now, I'm trying to create a list with the Views module.

First problem: This list is a list of "parent" nodes AND should include a column with the following result: COUNT(child with a reference to the parent).

Second problem: The count result should include only published children.

Example 1 with 2 children published (2 children have a reference to the parent):

Title of parent node | 2

Example 2 with 1 child published (2 children have a reference to the parent):

Title of parent node | 1

Sorry if it's not totally clear, it's hard to explain

Above all of this, if the result could be sortable it will be a good news but I don't think it will be possible...


texts: Is there any procedure to exclude taxonomy vocabulary terms from views display

texts:
I am using drupal7. I created a view with nodes under category(Taxonomy) Vehicle.

It looks fine, I am able to output a good looking page with set of images, title,desc etc along with tags(I mean vocabulary == Vehicle).. Can any one guide me how to exclude taxonomy name from displaying in view.

Please help..

Thank you.


texts:
I have 2 fields; field_a and field_b.  When field_b is not empty, I need to append a hyphen after field_a.

EX: field_a - field_b

Then, when field_b is empty, it doesn't show the hyphen

EX: field_a

I have been trying THEME_preprocess_field and THEME_field in template.php, but can't get it to work.  This is what I have, but its basically just a copy, but I don't need all the extra stuff, and I need it to only show up on field_a when field_b is not empty.

function THEME_field($variables) {
  $output = '';

  $output .= '
';
  foreach ($variables['items'] as $delta => $item) {
    $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
    $output .= '
' . drupal_render($item) . ',' . '
';
  }
  $output .= '
';

  // Render the top-level DIV.
  $output = '
' . $output . '
';

  return $output;
}


texts: Why don't feeds get automatically imported?

texts:
I am using the Feeds module, and set the import period to once a day. The site  cron tasks run every hour, but I noticed that feeds don't get imported automatically. Manually importing them works fine.

How do I automatically import them?


texts: Gulp and Foundation: not compiling or what?

texts:
Whenever I make changes in my zurb foundation file, those changes are not showing up on Zurb's them that I installed on my Drupal site.  Is this an issue of needing to compile with gulp?

The gulpfile.js content is the following.

 var gulp        = require('gulp'),
   livereload  = require('gulp-livereload'),
   uglify      = require('gulp-uglifyjs'),
   browserSync = require('browser-sync'),
   sass        = require('gulp-sass'),
   autoprefixer= require('gulp-autoprefixer'),
   sourcemaps  = require('gulp-sourcemaps'),
   concat      = require('gulp-concat'),
   babel       = require('gulp-babel'),
   cp          = require('child_process'),
   imagemin    = require('gulp-imagemin'),
   pngquant    = require('imagemin-pngquant');
gulp.task('sass', function () {
 return gulp.src('./themes/zurb_foundation/scss/foundation.sass')
 .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
 .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 7', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
 .pipe(sourcemaps.write('./'))
 .pipe(gulp.dest('./themes/zurb_foundation/css/foundation.css'))
 .pipe(browserSync.reload({stream:true}))
});
gulp.task('watch', function(){
  livereload.listen();
  gulp.watch('./themes/zurb_foundation/scss/**/*.scss', ['sass']);
  gulp.watch('./themes/zurb_foundation/js/**/*.js', ['uglify']);
  gulp.watch(['./themes/zurb_foundation/css/foundation.css',
  './themes/zurb_foundation/templates/*.twig',
  './themes/zurb_foundation/js/**/*.js'], function (files){
    livereload.changed(files)
  });
});

Gulp watch is running fine, but no changes are being made when I reload and/or clear cache.  For example, in the zurb_foundation/scss/foundation/_global.scss file if I put the following CSS styles, nothing happens after gulp watch, clearing cache, and reloading are all down without any warnings being triggered.

body {
  background: #000;
}


texts: How do I add a term reference name to the Pathauto pattern for a content type?

texts:
I'm trying to create a website with 2 sections, Home and Business. For this I have created a vocabulary called 'Page Type' and added those section names to it.

I've added a term reference field to my content type to relate nodes to my vocabulary.

What I need to do is automatically set the titles of the nodes to include the section name they are related to, using the Pathauto module.

I'm at the settings page (/admin/config/search/path/patterns) but I don't know what pattern to use - 'Page Type' is a vocabulary, not a content type, so I don't know how to use it as part of a pattern.

How do I add the name of the referred taxonomy term to the node path? For example, I'm expecting URLs like this:

example.com/home/page-title
example.com/business/page-title

So I want the node page to have a vocabulary in its path, the vocabulary of a term it is tagged with.


texts: Import an Image Folder into one Image Field

texts:
I've searched a lot for my problem, but I haven't found an answer yet.

I want to achieve, that if somebody uploads a whole folder of images per FTP, it should be possible to select the folder during the creation of a new node and add them into one image field.

It must be somehow like the file_attach module of drupal 6.
But for Drupal 7 and for whole directories instead of single files.
Does anybody has a guess or solution for me?


texts: Add link to call by Skype in a message - relative reference

texts:
I have rules' module and in the last part I set an action to show a message. In that message I want to add a link to call one user by Skype, I am using this:

     $message = "Click to call to your student";

     echo $message;

That only works in php (You can try it http://phptester.net/).

But the problem is that Drupal is using that reference as a relative url so when I click it, it takes me to "http://www.example.com/yyyy/echo123?call". How can I do to do a reference to Skype?.

Thank you so much for your help.


texts: How do I change the site name in the .theme file?

texts: I'm looking for a solution to change the site name in a .theme file in Drupal 8. I'm using the Group module and want to display a different site name when the current user navigate inside each group. How can I achieve this ?


texts: How to limit access to certain users for those who have "administer users" permission

texts:
EDIT: I have found out how to solve the 'administer users permission needed' problem so I don't really need to know the answer for this. I will not delete the question however, since I would like to know the answer out of curiosity anyway.

Because of this I need to give the permission 'administer users' to everyone while still being able to manage access to individual users (to their view and edit pages as well as to their cancellation).

Therefore I need to restrict users with 'administer users' permission to be able to edit just certain users (based on their id and the id of the user that is to be viewed or edited). (the access function itself is not the problem I already have that one)

I thought about doing something like 'Administer Users by Role' plugin but as it seems there are just too many potential security issues there (the 'administer users permission' is not used only in access to user edit/view but e.g in access to user fields settings page as well.

Any ideas?


texts: Is it possible in Views to get parent term of parent term all the way up a tree

texts:
I'm at my wits end on this. Here's my situation:

I have a content type which references a Vocabulary of geographical areas which actually has 6 levels ("Island Chain > Region > Province > City > District > Precinct").
I've used Hierarchical Select to control data entry, and set it so that the entire lineage is kept in each attached node - the node should be attached at the precinct level.

Now, what I want to do is to create a View which allows me to display a table of nodes, grouped by geographical area, and at the same time allow the user to select the geographical area he wishes to display (preferably at any level in the hierarchy).

I've already done something like this using a View by Taxonomy formatted as a table, attaching the content, and then displaying in each table row the node data, the term, and the parent term. However, this only seems to work for two levels (ie a Vocabulary where there is only a parent/child relationship), and I'm stuck on displaying the bottom level, then its parent, then its parent again, all the way up to the top and all in the same row so that I don't get duplicate lines and can group/aggregate data at all these different levels.

By the way, it seems that the Hierarchical Select Views module still does not work for D7 - or at least, I can't find out how to display it.


texts: Customize email template layout of built-in emails?

texts:
How to customize the layout of email templates of built-in emails sent by Drupal: Signup, Password Resetetc..
Currently it's sending plain template.
I have tried with hook_mail() hook, but seems that hook is not being called, also I have tried hook_email_alter() this is being called, but don't know how to pass #theme variable to inject my twig file.
Following is the code so far I have tried:
function ppl_misc_theme($existing, $type, $theme, $path){
    return [
        'generic_email' => [
          'variables' => [
            'title' => '',
            'body' => ''
          ],
          'template' => 'generic-email',
          'path' => drupal_get_path('theme', 'bootstrap_barrio_ppl').'/templates/email',
        ],
    ];
}

function ppl_misc_mail($key, &$message, $params) {
    // \Drupal::logger('Kaleem')->notice($key);
    // \Drupal::logger('Theme Path')->notice(drupal_get_path('theme', 'bootstrap_barrio_ppl'));
    $options = array(
      'langcode' => $message['langcode'],
    );

    $render_email = [
      '#theme' => 'generic_email',
      '#title' => 'This is title of email',
      '#status' => 'This is status',
    ];

    $mail = drupal_render($render_email);
    $message['body'][] = $mail;

  }

  function ppl_misc_mail_alter(&$message){
    if (!empty($message['id']) && $message['id'] == 'user_password_reset') {
        \Drupal::logger('Kaleem_alter')->notice($message['id']);
        \Drupal::logger('Kaleem_alter')->notice('This is notice text');
        // $message['body'] = 'This is custom body text';
    }
  }


texts: How to group multiple blocks into one big block

texts:
I have a website with Drupal 7 and the customer just asked to make it "responsive design".

I need, for the design to respond correctly, to group some blocks I already have into some bigger blocks, on which i can apply the specific classes I need.

Region aren't valid for me because the website is already built and it would be really messy to change it just to add regions.

Any ideas?

Thanks


texts:
I have a quiz with 5 questions of 10 points each one. When I score them, some exams save the result of the quiz with more than 100 points.

As you can see, I have an exam with 112 but if I open:

Look that the total score is 92% (but his score is 112).

In the other hand, the user with 100 scores is right.

So, as summary of this, I've got users with right total score but some of them have a wrong final score.

The module that I'm using is Quiz drupal.org/project/quiz version 7.x-5.0-alpha9.

Any idea?

Thanks!


texts:
I have created a custom page which has a db query to return content, which is using the pagerdefault extender on a Drupal 7 install.

However when I return the content the pager shows but not the content.  This is the code after the query:

$content = array();
foreach ($result AS $events)
{
    $content[] = '
' . $events->type . ' - ' . $events->nid . ' - ' . $events->tutorial_start . $events->event_start . '
';
}
$build += $content;
$build['pager'] = array(
    '#theme' => 'pager',
    '#weight' => 1,
);
return $build;

I can see the $content rows if I dsm $build, but not display them on the page.  How do I render them on the page?


texts: How to programmatically save a value in a long text with summary field?

texts:
I have a content type which has a field of type "long text with summary".

When I to try programmatically save a node with the code below, the value is not being saved.

How can I save the data into the field and set the format to "full_html"?

what does not work (assume the rest of the fields are set):

$node = new stdClass();
$node->type ='some_type';
$node->language = 'en';
node_object_prepare($node);
$node->field_custom_description_value = 'some_value';
$node->field_custom_description_format = 'full_html';

/* I also tried this */
$node->field_custom_description[$node->language][0]['value']-> 'some_value';
$node->field_custom_description[$node->language][0][format]-> 'full_html';


texts: Let users upload images from social networks

texts:
I'm trying to build a website that gives user's a profile page where they can either upload images from their computer or pull them in from Facebook and Instagram.

Ideally i'd like the user to have an interface where they can select the source of the images and start adding images - Or better yet, have a feed from Instagram per user that updates itself.

Currently, I just have an image field and a gallery created with views.

I found a resource online called Filepicker.io but it's not free and Drupal support seems minimal at best:

Is there any way this is possible?


texts: How to set default value of select list field on add node form?

texts:
I am trying to set the default value of a select list field on a node add form. The field name attribute in the HTML of the form is:

field_state[und]

The ID of the add form is:

local-affiliate-node-form

I created a little module to try to do this. It just has this code in it:

function MODULENAME_form_alter(&$form, $form_state, $form_id) {
    if($form_id == 'local-affiliate-node-form'){
        $form['field_state']['und']['#value'] = 17;
    }
}

I enabled the module and cleared cache but it doesn't appear to work. I also tried these lines inside the IF statement:

$form['field_state']['und']['value'] = 17;
$form['field_state']['und']['value']['#value'] = 17;
$form['field_state']['und']['#default_value'] = 17;

In case you're wondering, I can't use the Drupal interface to set the default value because eventually that "17" will be dynamic, so it will change depending on what the user clicks and I will use a string in the URL in place of a static number.

Thanks for any help!